ember-cli / broccoli-asset-rev

Broccoli plugin to add fingerprint checksums and CDN URLs to your assets
MIT License
87 stars 84 forks source link

/assets/ hardcoded in various places #79

Open jaylett opened 8 years ago

jaylett commented 8 years ago

The Broccoli walkthrough puts assets in app/, but broccoli-asset-rev assumes that many things will be in assets/, as well as having defaults (for manifest/assetMap files) there. The following seem to be affected:

The second I'm (a) not hugely fussed about, and (b) don't know how to trigger given Broccoli doesn't want to overwrite build trees. But the first means that something like the following (which may not be the "right" way of doing things, but doesn't give errors) misses app.css and app.js from the Rails manifest:

/* Brocfile.js */

// Import some Broccoli plugins
var compileSass = require('broccoli-sass');
var filterCoffeeScript = require('broccoli-coffee');
var mergeTrees = require('broccoli-merge-trees');
var rev = require('broccoli-asset-rev');

// Specify the Sass and Coffeescript directories
var sassDir = 'app/scss';
var coffeeDir = 'app/coffeescript';

// Tell Broccoli how we want the assets to be compiled
var styles = compileSass([sassDir], 'app.scss', 'app.css');
var scripts = filterCoffeeScript(coffeeDir);
// Merge the compiled styles and scripts into one output directory.
var tree = mergeTrees([styles, scripts]);

var hashed = new rev(
    tree,
    {
        generateAssetMap: true,
        generateRailsManifest: true,
        railsManifestPath: 'manifest.json',
    }
);

module.exports = hashed;