Skip to content

Commit aaf04df

Browse files
committed
feat(gulp): add Gulp support
1 parent 7abdf9a commit aaf04df

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

app/generator.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ export default class Generator extends Base {
142142
this.filters[answers.router] = true;
143143
this.filters.bootstrap = !!answers.bootstrap;
144144
this.filters.uibootstrap = !!answers.uibootstrap;
145+
146+
this.scriptExt = answers.script === 'coffee' ? 'coffee' : 'js';
147+
this.templateExt = answers.markup;
148+
this.styleExt = answers.stylesheet;
149+
145150
cb();
146151
}.bind(this));
147152
},

app/templates/_package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"gulp-livereload": "^3.8.0",
5656
"gulp-load-plugins": "^1.0.0-rc.1",
5757
"gulp-minify-css": "^1.1.6",
58+
"gulp-mocha": "^2.1.3",
5859
"gulp-ngmin": "^0.3.0",
5960
"gulp-plumber": "^1.0.1",
6061
"gulp-rev": "^5.0.0",

app/templates/gulpfile.babel(gulp).js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var plugins = gulpLoadPlugins();
1717
var config;
1818

1919
const paths = {
20+
appPath: require('./bower.json').appPath || 'client',
2021
client: {
2122
assets: 'client/assets/**/*',
2223
images: 'client/assets/images/*',
@@ -164,7 +165,7 @@ gulp.task('inject:<%= styleExt %>', () => {
164165
.replace('/client/app/', '')
165166
.replace('/client/components/', '../components/')
166167
.replace(/_(.*).<%= styleExt %>/, (match, p1, offset, string) => p1);
167-
return `@import '${newPath}';`
168+
return '@import \'' + newPath + '\';';
168169
}
169170
}))
170171
.pipe(gulp.dest('client/app'));
@@ -241,15 +242,15 @@ gulp.task('watch', () => {
241242
.pipe(lintServerScripts())
242243
.pipe(plugins.livereload());
243244

244-
gulp.watch('bower.json', ['bower']);
245+
gulp.watch('bower.json', ['wiredep:client']);
245246
});
246247

247248
gulp.task('serve', cb => {
248249
runSequence('clean:tmp',
249250
['lint:scripts'],
250251
'inject:js',
251252
'inject:css',
252-
'bower',<% if(filters.babel || filters.coffee) { %>
253+
'wiredep:client',<% if(filters.babel || filters.coffee) { %>
253254
['transpile', 'styles'],<% } else { %>
254255
'styles',<% } %>
255256
['start:server', 'start:client'],
@@ -273,14 +274,38 @@ gulp.task('test:client', () => {
273274
});
274275

275276
// inject bower components
276-
gulp.task('bower', () => {
277+
gulp.task('wiredep:client', () => {
277278
return gulp.src(paths.views.main)
278279
.pipe(wiredep({
279-
exclude: [/bootstrap-sass-official/, /bootstrap.js/, '/json3/', '/es5-shim/', /bootstrap.css/, /font-awesome.css/ ]
280+
exclude: [
281+
/bootstrap-sass-official/,
282+
/bootstrap.js/,
283+
'/json3/',
284+
'/es5-shim/',
285+
/bootstrap.css/,
286+
/font-awesome.css/
287+
],
288+
ignorePath: paths.appPath
280289
}))
281290
.pipe(gulp.dest('client/'));
282291
});
283292

293+
gulp.task('wiredep:test', () => {
294+
gulp.src(paths.karma)
295+
.pipe(wiredep({
296+
exclude: [
297+
/bootstrap-sass-official/,
298+
/bootstrap.js/,
299+
'/json3/',
300+
'/es5-shim/',
301+
/bootstrap.css/,
302+
/font-awesome.css/
303+
],
304+
devDependencies: true
305+
}))
306+
.pipe(gulp.dest('./'));
307+
});
308+
284309
/********************
285310
* Build
286311
********************/
@@ -290,7 +315,7 @@ gulp.task('build', cb => {
290315
runSequence(
291316
'clean:dist',
292317
'inject',
293-
'bower',
318+
'wiredep:client',
294319
[
295320
'build:images',
296321
'copy:extras',

0 commit comments

Comments
 (0)