@@ -16,7 +16,9 @@ module.exports = function () {
1616 ngModules = _ . flatten ( [
1717 ngModules ,
1818 this . props . resource . module ,
19- this . props . router . module
19+ this . props . router . module ,
20+ this . props . ui . module ,
21+ this . props . bootstrapComponents . module
2022 ] ) ;
2123
2224 this . modulesDependencies = _ . chain ( ngModules )
@@ -25,8 +27,7 @@ module.exports = function () {
2527 return '\'' + dependency + '\'' ;
2628 } )
2729 . valueOf ( )
28- . join ( ', ' )
29- ;
30+ . join ( ', ' ) ;
3031
3132 // Format list techs used to generate app included in main view of sample
3233 var listTechs = require ( '../techs.json' ) ;
@@ -35,30 +36,35 @@ module.exports = function () {
3536 'angular' , 'browsersync' , 'gulp' , 'jasmine' , 'karma' , 'protractor' ,
3637 this . props . jQuery . name ,
3738 this . props . ui . key ,
39+ this . props . bootstrapComponents . key ,
3840 this . props . cssPreprocessor . key
3941 ]
4042 . filter ( _ . isString )
4143 . filter ( function ( tech ) {
42- return tech !== 'default' && tech !== 'css' ;
43- } )
44- ;
44+ return tech !== 'default' && tech !== 'css' && tech !== 'official' && tech !== 'none' ;
45+ } ) ;
4546
4647 var techsContent = _ . map ( usedTechs , function ( value ) {
4748 return listTechs [ value ] ;
4849 } ) ;
4950
50- this . technologies = JSON . stringify ( techsContent , null , 2 ) . replace ( / " / g, '\'' ) . replace ( / \n / g, '\n ' ) ;
51+ this . technologies = JSON . stringify ( techsContent , null , 2 )
52+ . replace ( / ' / g, '\\\'' )
53+ . replace ( / " / g, '\'' )
54+ . replace ( / \n / g, '\n ' ) ;
5155 this . technologiesLogoCopies = _ . map ( usedTechs , function ( value ) {
5256 return 'src/assets/images/' + listTechs [ value ] . logo ;
5357 } ) ;
5458
5559 // Select partials relative to props.ui
60+ var uiFileKey = this . props . ui . key === 'ui-bootstrap' ? 'bootstrap' : this . props . ui . key ;
61+
5662 this . partialCopies = { } ;
5763
58- var navbarPartialSrc = 'src/components/navbar/__' + this . props . ui . key + '-navbar.html' ;
64+ var navbarPartialSrc = 'src/components/navbar/__' + uiFileKey + '-navbar.html' ;
5965 this . partialCopies [ navbarPartialSrc ] = 'src/components/navbar/navbar.html' ;
6066
61- var routerPartialSrc = 'src/app/main/__' + this . props . ui . key + '.html' ;
67+ var routerPartialSrc = 'src/app/main/__' + uiFileKey + '.html' ;
6268 if ( this . props . router . module !== null ) {
6369 this . partialCopies [ routerPartialSrc ] = 'src/app/main/main.html' ;
6470 }
@@ -81,25 +87,50 @@ module.exports = function () {
8187 this . routerJs = '' ;
8288 }
8389
90+ // Wiredep exclusions
91+ this . wiredepExclusions = [ ] ;
92+ if ( this . props . bootstrapComponents . key !== 'official' ) {
93+ if ( this . props . cssPreprocessor . extension === 'scss' ) {
94+ this . wiredepExclusions . push ( '/bootstrap-sass-official/' ) ;
95+ } else {
96+ this . wiredepExclusions . push ( '/bootstrap.js/' ) ;
97+ }
98+ }
99+ if ( this . props . cssPreprocessor . key !== 'css' ) {
100+ this . wiredepExclusions . push ( '/bootstrap.css/' ) ;
101+ }
102+
84103 // Format choice UI Framework
85- if ( this . props . ui . key === 'bootstrap' && this . props . cssPreprocessor . extension !== 'scss' ) {
104+ if ( this . props . ui . key . indexOf ( 'bootstrap' ) !== - 1 && this . props . cssPreprocessor . extension !== 'scss' ) {
86105 this . props . ui . name = 'bootstrap' ;
87106 }
88107
89108 this . styleCopies = { } ;
90109
91- var styleAppSrc = 'src/app/__' + this . props . ui . key + '-index.' + this . props . cssPreprocessor . extension ;
110+ var styleAppSrc = 'src/app/__' + uiFileKey + '-index.' + this . props . cssPreprocessor . extension ;
92111 this . styleCopies [ styleAppSrc ] = 'src/app/index.' + this . props . cssPreprocessor . extension ;
93112
94- // ## Special case for Foundation and LESS: Foundation dont have a LESS version so we include css
95- if ( ( this . props . cssPreprocessor . extension === 'less' && this . props . ui . key === 'foundation' ) || this . props . cssPreprocessor . extension === 'css' || this . props . cssPreprocessor . extension === 'styl' ) {
96- this . isVendorStylesPreprocessed = false ;
97- } else {
98- this . isVendorStylesPreprocessed = true ;
113+ // There is 2 ways of dealing with vendor styles
114+ // - If the vendor styles exist in the css preprocessor chosen,
115+ // the best is to include directly the source files
116+ // - If not, the vendor styles are simply added as standard css links
117+ //
118+ // isVendorStylesPreprocessed defines which solution has to be used
119+ // regarding the ui framework and the css preprocessor chosen.
120+ this . isVendorStylesPreprocessed = false ;
121+
122+ if ( this . props . cssPreprocessor . extension === 'scss' ) {
123+ if ( this . props . ui . key === 'bootstrap' || this . props . ui . key === 'foundation' ) {
124+ this . isVendorStylesPreprocessed = true ;
125+ }
126+ } else if ( this . props . cssPreprocessor . extension === 'less' ) {
127+ if ( this . props . ui . key === 'bootstrap' ) {
128+ this . isVendorStylesPreprocessed = true ;
129+ }
99130 }
100131
101132 if ( this . isVendorStylesPreprocessed && this . props . ui . name !== null ) {
102- var styleVendorSource = 'src/app/__' + this . props . ui . key + '-vendor.' + this . props . cssPreprocessor . extension ;
133+ var styleVendorSource = 'src/app/__' + uiFileKey + '-vendor.' + this . props . cssPreprocessor . extension ;
103134 this . styleCopies [ styleVendorSource ] = 'src/app/vendor.' + this . props . cssPreprocessor . extension ;
104135 }
105136} ;
0 commit comments