Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/assets/ hardcoded in various places #79

Open
jaylett opened this issue Nov 9, 2015 · 0 comments
Open

/assets/ hardcoded in various places #79

jaylett opened this issue Nov 9, 2015 · 0 comments

Comments

@jaylett
Copy link

jaylett commented Nov 9, 2015

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:

  • filter controlling which files in the asset map are written to the Rails/Sprockets-compatible manifest
  • location of existing Rails manifest

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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant