Skip to content

Commit f08778d

Browse files
committed
style injection of both deps and sources
1 parent 75de994 commit f08778d

33 files changed

Lines changed: 131 additions & 82 deletions

app/src/ui.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module.exports = function(GulpAngularGenerator) {
8080
if (this.props.ui.key === 'bootstrap') {
8181
if(this.props.bootstrapComponents.key !== 'official') {
8282
if(this.props.cssPreprocessor.extension === 'scss') {
83-
this.wiredepExclusions.push('/bootstrap-sass-official/');
83+
this.wiredepExclusions.push('/bootstrap-sass-official\\/.*\\.js/');
8484
} else {
8585
this.wiredepExclusions.push('/bootstrap\\.js/');
8686
}

app/templates/_gulpfile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
var gulp = require('gulp');
44
var gutil = require('gulp-util');
5-
var _ = require('lodash');
65
var wrench = require('wrench');
76

87
var options = {
@@ -15,6 +14,12 @@ var options = {
1514
gutil.log(gutil.colors.red('[' + title + ']'), err.toString());
1615
this.emit('end');
1716
};
17+
},
18+
wiredep: {
19+
directory: 'bower_components'
20+
<% if(wiredepExclusions.length > 0) { %>,
21+
exclude: [<%= wiredepExclusions.join(', ') %>]
22+
<% } %>
1823
}
1924
};
2025

app/templates/gulp/_inject.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ module.exports = function(options) {
1919
options.src + '/app/**/*.css'
2020
], { read: false });
2121
<% } %>
22-
2322
<% if (props.jsPreprocessor.key === 'typescript') { %>
23+
2424
var sortOutput = require('../' + options.tmp + '/sortOutput.json');
2525
<% } %>
2626

@@ -49,17 +49,10 @@ module.exports = function(options) {
4949
addRootSlash: false
5050
};
5151

52-
var wiredepOptions = {
53-
directory: 'bower_components'
54-
<% if(wiredepExclusions.length > 0) { %>,
55-
exclude: [<%= wiredepExclusions.join(', ') %>]
56-
<% } %>
57-
};
58-
5952
return gulp.src(options.src + '/*.html')
6053
.pipe($.inject(injectStyles, injectOptions))
6154
.pipe($.inject(injectScripts, injectOptions))
62-
.pipe(wiredep(wiredepOptions))
55+
.pipe(wiredep(options.wiredep))
6356
.pipe(gulp.dest(options.tmp + '/serve'));
6457

6558
});

app/templates/gulp/_styles.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ var browserSync = require('browser-sync');
55

66
var $ = require('gulp-load-plugins')();
77

8+
var wiredep = require('wiredep').stream;
9+
810
module.exports = function(options) {
911
gulp.task('styles', function () {
1012
<% if (props.cssPreprocessor.key === 'less') { %>
@@ -37,6 +39,7 @@ module.exports = function(options) {
3739
};
3840

3941
var indexFilter = $.filter('index.<%= props.cssPreprocessor.extension %>');
42+
var vendorFilter = $.filter('vendor.<%= props.cssPreprocessor.extension %>');
4043
<% if (props.cssPreprocessor.key === 'ruby-sass') { %>
4144
var cssFilter = $.filter('**/*.css');
4245
<% } %>
@@ -45,28 +48,31 @@ module.exports = function(options) {
4548
options.src + '/app/index.<%= props.cssPreprocessor.extension %>',
4649
options.src + '/app/vendor.<%= props.cssPreprocessor.extension %>'
4750
])
48-
.pipe(indexFilter)
49-
.pipe($.inject(injectFiles, injectOptions))
50-
.pipe(indexFilter.restore())
51+
.pipe(indexFilter)
52+
.pipe($.inject(injectFiles, injectOptions))
53+
.pipe(indexFilter.restore())
54+
.pipe(vendorFilter)
55+
.pipe(wiredep(options.wiredep))
56+
.pipe(vendorFilter.restore())
5157
<% if (props.cssPreprocessor.key === 'ruby-sass') { %>
52-
.pipe($.rubySass(sassOptions)).on('error', options.errorHandler('RubySass'))
53-
.pipe(cssFilter)
54-
.pipe($.sourcemaps.init({ loadMaps: true }))
58+
.pipe($.rubySass(sassOptions)).on('error', options.errorHandler('RubySass'))
59+
.pipe(cssFilter)
60+
.pipe($.sourcemaps.init({ loadMaps: true }))
5561
<% } else { %>
56-
.pipe($.sourcemaps.init())
62+
.pipe($.sourcemaps.init())
5763
<% } if (props.cssPreprocessor.key === 'less') { %>
58-
.pipe($.less(lessOptions)).on('error', options.errorHandler('Less'))
64+
.pipe($.less(lessOptions)).on('error', options.errorHandler('Less'))
5965
<% } else if (props.cssPreprocessor.key === 'node-sass') { %>
60-
.pipe($.sass(sassOptions)).on('error', options.errorHandler('Sass'))
66+
.pipe($.sass(sassOptions)).on('error', options.errorHandler('Sass'))
6167
<% } else if (props.cssPreprocessor.key === 'stylus') { %>
62-
.pipe($.stylus()).on('error', options.errorHandler('Stylus'))
68+
.pipe($.stylus()).on('error', options.errorHandler('Stylus'))
6369
<% } %>
64-
.pipe($.autoprefixer()).on('error', options.errorHandler('Autoprefixer'))
65-
.pipe($.sourcemaps.write())
70+
.pipe($.autoprefixer()).on('error', options.errorHandler('Autoprefixer'))
71+
.pipe($.sourcemaps.write())
6672
<% if (props.cssPreprocessor.key === 'ruby-sass') { %>
67-
.pipe(cssFilter.restore())
73+
.pipe(cssFilter.restore())
6874
<% } %>
69-
.pipe(gulp.dest(options.tmp + '/serve/app/'))
70-
.pipe(browserSync.reload({ stream: true }));
75+
.pipe(gulp.dest(options.tmp + '/serve/app/'))
76+
.pipe(browserSync.reload({ stream: true }));
7177
});
7278
};

app/templates/gulp/_unit-tests.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ var _ = require('lodash');
1111

1212
module.exports = function(options) {
1313
function listFiles(callback) {
14-
var bowerDeps = wiredep({
15-
directory: 'bower_components',
16-
<% if(wiredepExclusions.length > 0) { %>
17-
exclude: [<%= wiredepExclusions.join(', ') %>],
18-
<% } %>
14+
var wiredepOptions = _.extend({}, options.wiredep, {
1915
dependencies: true,
2016
devDependencies: true
2117
});
18+
var bowerDeps = wiredep(wiredepOptions);
2219

2320
var specFiles = [
2421
options.src + '/**/*.spec.js',

app/templates/src/app/_angular-material/__angular-material-index.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ section.jumbotron {
5353
}
5454
}
5555
}
56+
57+
/* Do not remove this comments bellow. It's the markers used by gulp-inject to inject
58+
all your less files automatically */
59+
// injector
60+
// endinjector

app/templates/src/app/_angular-material/__angular-material-index.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ section.jumbotron {
5353
}
5454
}
5555
}
56+
57+
/* Do not remove this comments bellow. It's the markers used by gulp-inject to inject
58+
all your sass files automatically */
59+
// injector
60+
// endinjector

app/templates/src/app/_angular-material/__angular-material-index.styl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,8 @@ section
4141
&.pull-right
4242
float right
4343
width 50px
44+
45+
/* Do not remove this comments bellow. It's the markers used by gulp-inject to inject
46+
all your stylus files automatically */
47+
// injector
48+
// endinjector
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/* Do not remove this comments bellow. It's the markers used by wiredep to inject
22
less dependencies when defined in the bower.json of your dependencies */
3-
// injector
4-
// endinjector
3+
// bower:less
4+
// endbower
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/* Do not remove this comments bellow. It's the markers used by wiredep to inject
22
sass dependencies when defined in the bower.json of your dependencies */
3-
// injector
4-
// endinjector
3+
// bower:scss
4+
// endbower

0 commit comments

Comments
 (0)