1

我正在关注这里的示例http://reefpoints.dockyard.com/2014/05/07/building-an-ember-app-with-rails-part-1.html我尝试使用安装 twitter bootstrap此处的解决方案推荐在 Ember.JS ember-cli App 中包含引导库的方法,但它对我不起作用。

当我查看页面源代码时,我看到:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Bostonember</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <base href="/" />

    <link rel="stylesheet" href="assets/bostonember.css">
  </head>
  <body>
    <script>
      window.ENV = {"baseURL":"/","locationType":"auto","FEATURES":{},"APP":{"LOG_RESOLVER":true,"LOG_ACTIVE_GENERATION":true,"LOG_MODULE_RESOLVER":true,"LOG_VIEW_LOOKUPS":true},"LOG_MODULE_RESOLVER":true};
    </script>
    <script src="assets/bostonember.js"></script>
    <script>
      window.Bostonember = require('bostonember/app')['default'].create(ENV.APP);
    </script>

<script type="text/javascript">document.write('<script src="' + (location.protocol || 'http:') + '//' + (location.hostname || 'localhost') + ':35729/livereload.js?snipver=1" type="text/javascript"><\/script>')</script>
</body>
</html>

这是我的 Broc 文件:

/* global require, module */

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var app = new EmberApp({
  name: require('./package.json').name,

  minifyCSS: {
    enabled: true,
    options: {}
  },

  getEnvJSON: require('./config/environment')
});

// Use this to add additional libraries to the generated output files.
app.import('vendor/ember-data/ember-data.js');
app.import('vendor/bootstrap/dist/js/bootstrap.js');
app.import('vendor/bootstrap/dist/css/bootstrap.css')


// If the library that you are including contains AMD or ES6 modules that
// you would like to import into your application please specify an
// object with the list of modules as keys along with the exports of each
// module as its value.
app.import('vendor/ic-ajax/dist/named-amd/main.js', {
  'ic-ajax': [
    'default',
    'defineFixture',
    'lookupFixture',
    'raw',
    'request',
  ]
});

app.import({development:'vendor/route-recognizer/dist/route-recognizer.js'});
app.import({development:'vendor/FakeXMLHttpRequest/fake_xml_http_request.js'});
app.import({development:'vendor/pretender/pretender.js'});
module.exports = app.toTree();

除了我尝试安装 twitter bootstrap 之外,没有其他任何不同的地方可以帮忙吗?

4

1 回答 1

3

我认为您需要添加

<link rel="stylesheet" href="assets/vendor.css">

明确地到您的 index.html 的 head 部分。

Broc 文件声明中的导入语句应该将引导 css 添加到 vendor.css,我必须链接该文件以使其工作。

于 2014-06-02T13:06:20.650 回答