简体   繁体   中英

Ember 1.13.1 vendor/assets not loading

Edit

Problem appears to be having brocfile.js instead of migrating to ember-cli-build.js . This article clears it up: https://github.com/ember-cli/ember-cli/blob/master/TRANSITION.md .

I'm following along with the ember-cli 101 tutorial and we are supposed to get assets from picnic and fontello but the assets aren't getting recognized/loaded if I go to http://localhost:4200/assets/vendor.css . In fact, if I go there, the Ember console doesn't detect an Ember app at all.

I believe it might have to do with the content security policy changes I made just to make it not throw the violation to begin with:

config/environment.js:

contentSecurityPolicy: {
  'default-src': "'none'",
  'script-src': "'self' 'unsafe-inline' 'unsafe-eval'",
  'font-src': "'self'",
  'connect-src': "'self'",
  'img-src': "'self'",
  'style-src': "'self' 'unsafe-inline'",
  'frame-src': "'none'"
}

Brocfile.js:

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

var app = new EmberApp({});

app.import('vendor/fontello/fontello.css');
app.import('vendor/fontello/font/fontello.ttf', {
  destDir: 'assets/fonts'
});
app.import('vendor/fontello/font/fontello.eot', {
  destDir: 'assets/fonts'
});
app.import('vendor/fontello/font/fontello.svg', {
  destDir: 'assets/fonts'
});
app.import('vendor/fontello/font/fontello.woff', {
  destDir: 'assets/fonts'
});

app.import('bower_components/picnic/releases/plugins.min.css');
app.import('bower_components/picnic/releases/picnic.min.css');

module.exports = app.toTree();


Bower.json includes: 

    "picnic": "~3.3.1"

My directory structure is:

Brocfile.js
bower_components
    --> picnic 
bower.json
vendor
   --> fontello
            --> font 
                  --> fontello.eot / .svg .ttf .woff 

The source code for the tutorial is here: https://github.com/abuiles/borrowers .

Yes, I installed via Bower as well as restarted the server.

Its an ember-cli 1.13.0 issue, in 0.2.7 it still works. Open issue: https://github.com/ember-cli/ember-cli/issues/4446

I have the same problem following the same tutorial.

Just to make a note i have found that if you use the broccoli command line with the command 'broccoli build dist', broccoli makes a new dist folder (once you have delete or make a backup of the previous) with a font folder with the fonts of fontello and writes the vendor.css with the data of picnic files as it is supposed to be.

But, if you run again ember server, it removes the fonts folder and leaves vendor.css in blank again.

At the moment is all i have found.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM