bootstrap.css 加载,使用骨干中的require为模板加载bootstrap.css?

我的主要JS有以下代码 -

/*global require*/

'use strict';

require.config({

shim: {

backbone:{

deps:[

'underscore',

'jquery'

],

exports: 'Backbone'

},

bootstrap:{deps:['jquery']},

},

paths: {

jquery: '../bower_components/jquery/dist/jquery',

backbone: '../bower_components/backbone/backbone',

underscore: '../bower_components/underscore/underscore',

bootstrap: '../bower_components/bootstrap/dist/js/bootstrap',

text:'../bower_components/requirejs-text/text',

router: 'routes/router'

}

});

require([

'jquery',

'underscore',

'backbone',

'bootstrap',

'router'

//'text!bootstrapCSS'

], function ($, _, Backbone, undefined, mainRouter) {

var router = new mainRouter();

Backbone.history.start();

});

和view.home.js具有以下代码

define(

[

'jquery',

'underscore',

'backbone',

'bootstrap',

'text!templates/header.html',

'text!/bower_components/bootstrap/dist/css/bootstrap.css'

],

function($, _, Backbone, undefined, header, bootstrapCSS){

var HomeView = Backbone.View.extend({

el: '.header-container',

headerTemplate: _.template(header),

initialize: function(){

console.log("in view-home initialize")

this.render();

},

render: function(){

console.log("render header");

this.$el.html(this.headerTemplate());

console.log("render header complete i guess");

},

events: {},

});

return HomeView;

})

以上代码用于在主html中呈现header.html。 header.html使用bootstrap类进行设计,主要是bootstrap.css。加载页面成功加载包括所有库在内的所有内容,但视图没有所需的显示 - 即它似乎没有引导程序。有什么不对的,我正在做的是我的加载的html没有显示引导程序,我如何通过主干中的require.js在我的header.html中包含bootstrap.css。

请帮忙。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值