build: separate demo-app in its own directory. (#451)

* build: separate demo-app in its own directory.

* chore: replace gulp-inline-resources with a script

This also improves upon the relative path problem. All template paths
now should be relative. Also, we can now include double-quotes in
CSS/HTML.
This commit is contained in:
Hans
2016-05-18 15:07:57 -07:00
parent 9433556b0a
commit 9e308a6fa2
63 changed files with 435 additions and 231 deletions
+45 -15
View File
@@ -5,7 +5,6 @@ const path = require('path');
// Import the require hook. Enables us to require TS files natively.
require('ts-node/register');
const Angular2App = require('angular-cli/lib/broccoli/angular2-app');
const Funnel = require('broccoli-funnel');
const MergeTree = require('broccoli-merge-trees');
@@ -13,8 +12,49 @@ const autoPrefixerTree = require('broccoli-autoprefixer');
module.exports = function(defaults) {
var angularAppTree = new Angular2App(defaults, {
sourceDir: 'src/',
// The Angular Application tree.
const appTree = _buildAppTree(defaults);
// The CSS tree that is auto prefixed with browser support.
const cssAutoprefixed = autoPrefixerTree(new Funnel(appTree, {
include: [ '**/*.css' ]
}));
return new MergeTree([appTree, cssAutoprefixed], { overwrite: true });
};
/**
* Build the Broccoli Tree containing all the files used as the input to the Angular2App.
*/
function _buildDemoAppInputTree() {
return new MergeTree([
new Funnel('typings', {
destDir: 'typings'
}),
new Funnel('src', {
include: ['components/**/*', 'core/**/*'],
destDir: 'src/demo-app'
}),
new Funnel('src/demo-app', {
destDir: 'src/demo-app'
})
]);
}
/**
* Build the Broccoli Tree that contains the Angular2 App. This picks between E2E, Example or Demo
* app.
* @param defaults The default objects from AngularCLI (deprecated).
* @returns {Angular2App}
*/
function _buildAppTree(defaults) {
let inputNode = _buildDemoAppInputTree();
return new Angular2App(defaults, inputNode, {
sourceDir: 'src/demo-app',
tsCompiler: {
},
sassCompiler: {
includePaths: [
'src/core/style'
@@ -27,17 +67,7 @@ module.exports = function(defaults) {
'es6-shim/es6-shim.js',
'reflect-metadata/*.js',
'rxjs/**/*.js',
'@angular/**/*.js',
'@angular/**/*.js'
]
});
const cssAutoprefixed = autoPrefixerTree(new Funnel(angularAppTree, {
include: [ '**/*.css' ]
}));
return new MergeTree([
new Funnel('src', { include: ['**/*.scss']}),
angularAppTree,
cssAutoprefixed,
], { overwrite: true });
};
}