@@ -22,7 +22,7 @@ var globby = require("globby");
2222// - because childProcess.kill does not work properly on windows
2323var treeKill = require ( "tree-kill" ) ;
2424var blc = require ( "broken-link-checker" ) ;
25-
25+ var less = require ( 'gulp-less' ) ;
2626var tslint = require ( 'gulp-tslint' ) ;
2727
2828// TODO:
@@ -41,6 +41,7 @@ var EXAMPLES_PROTRACTOR_PATH = path.join(EXAMPLES_PATH, '_protractor');
4141var NOT_API_DOCS_GLOB = path . join ( PUBLIC_PATH , './{docs/*/latest/!(api),!(docs)}/**/*.*' ) ;
4242var RESOURCES_PATH = path . join ( PUBLIC_PATH , 'resources' ) ;
4343var LIVE_EXAMPLES_PATH = path . join ( RESOURCES_PATH , 'live-examples' ) ;
44+ var STYLES_SOURCE_PATH = path . join ( TOOLS_PATH , 'styles-builder/less' ) ;
4445
4546var docShredder = require ( path . resolve ( TOOLS_PATH , 'doc-shredder/doc-shredder' ) ) ;
4647var exampleZipper = require ( path . resolve ( TOOLS_PATH , '_example-zipper/exampleZipper' ) ) ;
@@ -87,6 +88,7 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
8788
8889var _exampleBoilerplateFiles = [
8990 '.editorconfig' ,
91+ 'a2docs.css' ,
9092 'karma.conf.js' ,
9193 'karma-test-shim.js' ,
9294 'package.json' ,
@@ -98,14 +100,16 @@ var _exampleBoilerplateFiles = [
98100 'wallaby.js'
99101 ] ;
100102
101- var _exampleDartWebBoilerPlateFiles = [ 'styles.css' ] ;
103+ var _exampleDartWebBoilerPlateFiles = [ 'a2docs.css' , ' styles.css'] ;
102104
103105var _exampleProtractorBoilerplateFiles = [
104106 'tsconfig.json'
105107] ;
106108
107109var _exampleConfigFilename = 'example-config.json' ;
108110
111+ var _styleLessName = 'a2docs.less' ;
112+
109113// Gulp flags:
110114//
111115// --lang=[all | ts | js | dart | 'ts|js' | 'ts|js|dart' | ...]
@@ -118,7 +122,7 @@ var _exampleConfigFilename = 'example-config.json';
118122var lang , langs , buildDartApiDocs = false ;
119123function configLangs ( langOption ) {
120124 const fullSiteBuildTasks = [ 'build-compile' , 'check-serve' , 'check-deploy' ] ;
121- const buildAllDocs = argv [ '_' ] &&
125+ const buildAllDocs = argv [ '_' ] &&
122126 fullSiteBuildTasks . some ( ( task ) => argv [ '_' ] . indexOf ( task ) >= 0 ) ;
123127 const langDefault = buildAllDocs ? 'all' : 'ts|js' ;
124128 lang = ( langOption || langDefault ) . toLowerCase ( ) ;
@@ -190,7 +194,7 @@ function runE2e() {
190194 return spawnInfo . promise ;
191195 } )
192196 . then ( function ( ) {
193- copyExampleBoilerplate ( ) ;
197+ buildStyles ( copyExampleBoilerplate , _ . noop ) ;
194198 gutil . log ( 'runE2e: update webdriver' ) ;
195199 spawnInfo = spawnExt ( 'npm' , [ 'run' , 'webdriver:update' ] , { cwd : EXAMPLES_PROTRACTOR_PATH } ) ;
196200 return spawnInfo . promise ;
@@ -414,7 +418,7 @@ gulp.task('help', taskListing.withFilters(function(taskName) {
414418} ) ) ;
415419
416420// requires admin access because it adds symlinks
417- gulp . task ( 'add-example-boilerplate' , function ( ) {
421+ gulp . task ( 'add-example-boilerplate' , function ( done ) {
418422 var realPath = path . join ( EXAMPLES_PATH , '/node_modules' ) ;
419423 var nodeModulesPaths = excludeDartPaths ( getNodeModulesPaths ( EXAMPLES_PATH ) ) ;
420424
@@ -430,16 +434,26 @@ gulp.task('add-example-boilerplate', function() {
430434 fsUtils . addSymlink ( realPath , linkPath ) ;
431435 } ) ;
432436
433- return copyExampleBoilerplate ( ) ;
437+ return buildStyles ( copyExampleBoilerplate , done ) ;
434438} ) ;
435439
436440
437441// copies boilerplate files to locations
438442// where an example app is found
439- gulp . task ( '_copy-example-boilerplate' , function ( ) {
440- if ( ! argv . fast ) copyExampleBoilerplate ( ) ;
443+ gulp . task ( '_copy-example-boilerplate' , function ( done ) {
444+ if ( ! argv . fast ) buildStyles ( copyExampleBoilerplate , done ) ;
441445} ) ;
442446
447+ //Builds Angular 2 Docs CSS file from Bootstrap npm LESS source
448+ //and copies the result to the _examples folder to be included as
449+ //part of the example boilerplate.
450+ function buildStyles ( cb , done ) {
451+ gulp . src ( path . join ( STYLES_SOURCE_PATH , _styleLessName ) )
452+ . pipe ( less ( ) )
453+ . pipe ( gulp . dest ( EXAMPLES_PATH ) ) . on ( 'end' , function ( ) {
454+ cb ( ) . then ( function ( ) { done ( ) ; } ) ;
455+ } ) ;
456+ }
443457
444458// copies boilerplate files to locations
445459// where an example app is found
@@ -1251,7 +1265,7 @@ function buildApiDocsForDart() {
12511265 dab . createApiDataAndJadeFiles ( apiEntries ) ;
12521266
12531267 } ) . catch ( ( err ) => {
1254- console . log ( err ) ;
1268+ console . error ( err ) ;
12551269 } ) ;
12561270
12571271 } catch ( err ) {
0 commit comments