Skip to content

Commit 882c685

Browse files
committed
fix(build): fixed adding vendor CSS files to project
1 parent 9ee7b82 commit 882c685

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

gulpfile.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ var fnSass = function (path) {
2929
from: pkg.name + '-' + pkg.version + '.css',
3030
to: pkg.name + '-' + pkg.version + '.css'
3131
}))
32-
.pipe(plugins.concat(pkg.name + '-' + pkg.version + '.css'))
3332
.pipe(gulp.dest(config.build + '/assets'));
3433
};
3534
gulp.task('styles:sass:imports', function () {
@@ -48,9 +47,10 @@ gulp.task('styles:sass', ['styles:sass:imports'], function () {
4847
});
4948

5049
// Minify CSS
51-
gulp.task('styles', ['styles:sass'], function () {
52-
return gulp.src(config.build + '/assets/*.css')
53-
.pipe(plugins.size({ showFiles: true, title: '[CSS]' }))
50+
gulp.task('styles', ['styles:sass', 'vendor:css'], function () {
51+
var arr = (config.vendor_files.css).concat(config.build + '/assets/' + pkg.name + '-' + pkg.version + '.css');
52+
return gulp.src(arr)
53+
.pipe(plugins.concat(pkg.name + '-' + pkg.version + '.css'))
5454
.pipe(plugins.minifyCss({ keepSpecialComments: 0 }))
5555
.pipe(plugins.rename({ suffix: '.min' }))
5656
.pipe(plugins.size({ showFiles: true, title: '[CSS]' }))
@@ -71,6 +71,15 @@ gulp.task('vendor:js', function () {
7171
.pipe(gulp.dest(config.build));
7272
});
7373

74+
// Copy vendor css to /build/
75+
gulp.task('vendor:css', function () {
76+
if (!config.vendor_files.css.length) {
77+
return;
78+
}
79+
return gulp.src(config.vendor_files.css, { base: '.' })
80+
.pipe(gulp.dest(config.build));
81+
});
82+
7483
// Copy vendor assets to /build/
7584
gulp.task('vendor:assets', function () {
7685
if (!config.vendor_files.assets.length) {
@@ -244,7 +253,7 @@ gulp.task('test:watch', ['vendor:assets'], function () {
244253
// ============
245254

246255
// Add files to Watch
247-
gulp.task('watch', ['styles:sass', 'scripts:lint', 'scripts:cacheTpls', 'assets:img', 'vendor:js', 'vendor:assets', 'test:watch', 'html:inject'], function () {
256+
gulp.task('watch', ['styles:sass', 'scripts:lint', 'scripts:cacheTpls', 'assets:img', 'vendor:css', 'vendor:js', 'vendor:assets', 'test:watch', 'html:inject'], function () {
248257
require('./server.js')(server);
249258

250259
// watch for JS changes
@@ -313,7 +322,7 @@ gulp.task('clean', function () {
313322
// ===============
314323

315324
gulp.task('build', ['clean'], function () {
316-
gulp.start('styles:sass', 'scripts:lint', 'scripts:cacheTpls', 'vendor:js', 'vendor:assets', 'test:run', 'assets:img', 'html:inject');
325+
gulp.start('styles:sass', 'scripts:lint', 'scripts:cacheTpls', 'vendor:css', 'vendor:js', 'vendor:assets', 'test:run', 'assets:img', 'html:inject');
317326
});
318327

319328
gulp.task('compile', ['build'], function () {

0 commit comments

Comments
 (0)