I’d like to include a folder containing some static files in the ‘dist’ output directory unless the project is being built for production.
Can I configure this in broccoli? I know it does something similar with the test files but there is a LOT of code in the broccoli/ember-app.js file that seems to be doing this.
I was hoping for it to be a simple config.
Sure! Couple ways, either using .import()
for each file or using an if
statement with the environment flag for “pickFiles” (AKA broccoli-static-compiler).
// in your Brocfile.js
// each file individually
app.import({
production: false,
development: 'path/to/file'
});
// using pick files
if (app.env !== 'production') {
var extraAssets = pickFiles('path/to/folder', {
srcDir: '/',
files: ['*.jpg'],
destDir: '/assets/images'
});
app = app.toTree(extraAssets);
}
Take a look at the ember-cli documentation for details: The Ember CLI - Introduction - Ember CLI Guides