Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
| module.exports = function (broccoli) { | |
| var filterCoffeeScript = require('broccoli-coffee') | |
| var filterTemplates = require('broccoli-template') | |
| var uglifyJavaScript = require('broccoli-uglify-js') | |
| var compileES6 = require('broccoli-es6-concatenator') | |
| var pickFiles = require('broccoli-static-compiler') | |
| var env = require('broccoli-env').getEnv() | |
| function preprocess (tree) { | |
| tree = filterTemplates(tree, { | |
| extensions: ['hbs', 'handlebars'], | |
| compileFunction: 'Ember.Handlebars.compile' | |
| }) | |
| tree = filterCoffeeScript(tree, { | |
| bare: true | |
| }) | |
| return tree | |
| } | |
| var app = broccoli.makeTree('app') | |
| app = pickFiles(app, { | |
| srcDir: '/', | |
| destDir: 'appkit' // move into namespace | |
| }) | |
| app = preprocess(app) | |
| var tests = broccoli.makeTree('tests') | |
| tests = pickFiles(tests, { | |
| srcDir: '/', | |
| destDir: 'appkit/tests' | |
| }) | |
| tests = preprocess(tests) | |
| var sourceTrees = [app] | |
| if (env !== 'production') { | |
| sourceTrees.push(tests) | |
| } | |
| var appAndDependencies = new broccoli.MergedTree( | |
| sourceTrees.concat(broccoli.bowerTrees()) | |
| ) | |
| applicationJs = compileES6(appAndDependencies, { | |
| loaderFile: 'loader.js', | |
| ignoredModules: [ | |
| 'resolver' | |
| ], | |
| inputFiles: [ | |
| 'appkit/**/*.js' | |
| ], | |
| legacyFilesToAppend: [ | |
| 'jquery.js', | |
| 'handlebars.js', | |
| 'ember.js', | |
| 'ember-data.js', | |
| 'ember-resolver.js' | |
| ], | |
| wrapInEval: env !== 'production', | |
| outputFile: '/assets/app.js' | |
| }) | |
| if (env === 'production') { | |
| applicationJs = uglifyJavaScript(applicationJs, { | |
| // mangle: false, | |
| // compress: false | |
| }) | |
| } | |
| var indexHtml = pickFiles(app, { | |
| srcDir: '/appkit', | |
| files: ['*.html'], | |
| destDir: '/' | |
| }) | |
| var public = broccoli.makeTree('public') | |
| return [applicationJs, public, indexHtml] | |
| } |