M
M
Muhammad2015-11-15 21:54:06
Node.js
Muhammad, 2015-11-15 21:54:06

Why is the file added to the exception deleted?

A small task to clean up folders ( del package ):

var del = require('del');
...
gulp.task('clean', function () {
  return del(['build', 'public/**', '!public/**/vendor.{js,css}']);
});

Those. buildthe folder and all the contents of the folder should be deleted public, except for the vendor.css and vendor.js files (bower libraries compiled into one file), which are located in the and folders public/assets/css, public/assets/jsrespectively. This was done in order not to build libraries from bower, because it takes 3-4 seconds (by the way, is this normal?), but only on the first start or change bower.json(there is a separate watcher).
Bower library build task:
var uglify = require('gulp-uglify');
var minifyCss = require('gulp-minify-css');
var mainBowerFiles = require('gulp-main-bower-files');
var filter = require('gulp-filter');
var concat = require('gulp-concat');
var connect = require('gulp-connect');

gulp.task('bower', ['clean'], function () {
  var jsFilter = filter('**/*.js', { restore: true });
  var cssFilter = filter('**/*.css', { restore: true });

  return gulp.src('./bower.json')
    .pipe(mainBowerFiles())
    .pipe(cssFilter)
    .pipe(concat('vendor.css'))
    .pipe(minifyCss())
    .pipe(gulp.dest(path.dist.css))
    .pipe(cssFilter.restore)

    .pipe(jsFilter)
    .pipe(concat('vendor.js'))
    .pipe(uglify())
    .pipe(gulp.dest(path.dist.js))
    .pipe(jsFilter.restore)

    .pipe(connect.reload());
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Muhammad, 2015-11-17
@muhammad_97

SO: stackoverflow.com/questions/33748835/why-gulp-does...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question