Skip to content

Instantly share code, notes, and snippets.

@hparra
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hparra/a87ec42958feb113504d to your computer and use it in GitHub Desktop.
Save hparra/a87ec42958feb113504d to your computer and use it in GitHub Desktop.
Broccoli may be easier to understand if you think of it functionally
//
// Broccoli may be easier to understand if you think of it functionally
//
// This is an incomplete Brocfile.js! Not even sure if it's valid.
// Adapted from http://ampersate.com/getting-started-with-broccoli-and-emberjs
//
// Note: This would probably look nicer in CoffeeScript
// Note: This would probably look best in ClojureScript
//
var appjs =
compileES6(
new broccoli.MergedTree([
/* config tree */
preprocess(
pickFiles(broccoli.makeTree('config'), {
srcDir: '/',
destDir: 'config'
})),
/* app tree */
preprocess(
pickFiles(broccoli.makeTree('app'), {
srcDir: '/',
destDir: 'app'
})),
/* vendor tree */
broccoli.makeTree('vendor')
]
.concat(
/* bower tree */
broccoli.bowerTrees())),
/* options */
{
loaderFile: 'loader.js',
ignoredModules: [
'resolver'
],
inputFiles: [
'app/**/*.js'
],
legacyFilesToAppend: appFilesToAppend,
wrapInEval: env !== 'production',
outputFile: '/assets/app.js'
}
)
// Why Brendan. Why?
appjs = (env === 'production') ?
uglifyJavaScript(appJs, {
mangle: true,
compress: true
}) : appjs;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment