Last active
August 29, 2015 14:07
-
-
Save hparra/a87ec42958feb113504d to your computer and use it in GitHub Desktop.
Broccoli may be easier to understand if you think of it functionally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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