@@ -22,7 +22,7 @@ var globby = require("globby");
22
22
// - because childProcess.kill does not work properly on windows
23
23
var treeKill = require ( "tree-kill" ) ;
24
24
var blc = require ( "broken-link-checker" ) ;
25
-
25
+ var less = require ( 'gulp-less' ) ;
26
26
var tslint = require ( 'gulp-tslint' ) ;
27
27
28
28
// TODO:
@@ -41,6 +41,7 @@ var EXAMPLES_PROTRACTOR_PATH = path.join(EXAMPLES_PATH, '_protractor');
41
41
var NOT_API_DOCS_GLOB = path . join ( PUBLIC_PATH , './{docs/*/latest/!(api),!(docs)}/**/*.*' ) ;
42
42
var RESOURCES_PATH = path . join ( PUBLIC_PATH , 'resources' ) ;
43
43
var LIVE_EXAMPLES_PATH = path . join ( RESOURCES_PATH , 'live-examples' ) ;
44
+ var STYLES_SOURCE_PATH = path . join ( TOOLS_PATH , 'styles-builder/less' ) ;
44
45
45
46
var docShredder = require ( path . resolve ( TOOLS_PATH , 'doc-shredder/doc-shredder' ) ) ;
46
47
var exampleZipper = require ( path . resolve ( TOOLS_PATH , '_example-zipper/exampleZipper' ) ) ;
@@ -87,6 +88,7 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
87
88
88
89
var _exampleBoilerplateFiles = [
89
90
'.editorconfig' ,
91
+ 'a2docs.css' ,
90
92
'karma.conf.js' ,
91
93
'karma-test-shim.js' ,
92
94
'package.json' ,
@@ -98,14 +100,16 @@ var _exampleBoilerplateFiles = [
98
100
'wallaby.js'
99
101
] ;
100
102
101
- var _exampleDartWebBoilerPlateFiles = [ 'styles.css' ] ;
103
+ var _exampleDartWebBoilerPlateFiles = [ 'a2docs.css' , ' styles.css'] ;
102
104
103
105
var _exampleProtractorBoilerplateFiles = [
104
106
'tsconfig.json'
105
107
] ;
106
108
107
109
var _exampleConfigFilename = 'example-config.json' ;
108
110
111
+ var _styleLessName = 'a2docs.less' ;
112
+
109
113
// Gulp flags:
110
114
//
111
115
// --lang=[all | ts | js | dart | 'ts|js' | 'ts|js|dart' | ...]
@@ -118,7 +122,7 @@ var _exampleConfigFilename = 'example-config.json';
118
122
var lang , langs , buildDartApiDocs = false ;
119
123
function configLangs ( langOption ) {
120
124
const fullSiteBuildTasks = [ 'build-compile' , 'check-serve' , 'check-deploy' ] ;
121
- const buildAllDocs = argv [ '_' ] &&
125
+ const buildAllDocs = argv [ '_' ] &&
122
126
fullSiteBuildTasks . some ( ( task ) => argv [ '_' ] . indexOf ( task ) >= 0 ) ;
123
127
const langDefault = buildAllDocs ? 'all' : 'ts|js' ;
124
128
lang = ( langOption || langDefault ) . toLowerCase ( ) ;
@@ -190,7 +194,7 @@ function runE2e() {
190
194
return spawnInfo . promise ;
191
195
} )
192
196
. then ( function ( ) {
193
- copyExampleBoilerplate ( ) ;
197
+ buildStyles ( copyExampleBoilerplate , _ . noop ) ;
194
198
gutil . log ( 'runE2e: update webdriver' ) ;
195
199
spawnInfo = spawnExt ( 'npm' , [ 'run' , 'webdriver:update' ] , { cwd : EXAMPLES_PROTRACTOR_PATH } ) ;
196
200
return spawnInfo . promise ;
@@ -414,7 +418,7 @@ gulp.task('help', taskListing.withFilters(function(taskName) {
414
418
} ) ) ;
415
419
416
420
// requires admin access because it adds symlinks
417
- gulp . task ( 'add-example-boilerplate' , function ( ) {
421
+ gulp . task ( 'add-example-boilerplate' , function ( done ) {
418
422
var realPath = path . join ( EXAMPLES_PATH , '/node_modules' ) ;
419
423
var nodeModulesPaths = excludeDartPaths ( getNodeModulesPaths ( EXAMPLES_PATH ) ) ;
420
424
@@ -430,16 +434,26 @@ gulp.task('add-example-boilerplate', function() {
430
434
fsUtils . addSymlink ( realPath , linkPath ) ;
431
435
} ) ;
432
436
433
- return copyExampleBoilerplate ( ) ;
437
+ return buildStyles ( copyExampleBoilerplate , done ) ;
434
438
} ) ;
435
439
436
440
437
441
// copies boilerplate files to locations
438
442
// 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 ) ;
441
445
} ) ;
442
446
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
+ }
443
457
444
458
// copies boilerplate files to locations
445
459
// where an example app is found
@@ -1251,7 +1265,7 @@ function buildApiDocsForDart() {
1251
1265
dab . createApiDataAndJadeFiles ( apiEntries ) ;
1252
1266
1253
1267
} ) . catch ( ( err ) => {
1254
- console . log ( err ) ;
1268
+ console . error ( err ) ;
1255
1269
} ) ;
1256
1270
1257
1271
} catch ( err ) {
0 commit comments