0

So I have a gulpfile.js that worked as expected for the last few months. I did remove the node_modules directory and runned npm install. I really don't think I changed anything else. But now when I try to run the main task (named "default") it only runs one task (named "clean") and then stops. If I remove every dependence on the clean task, all the subtasks of "default" is run. I can't figure out why. I'm stuck!

var gulp = require('gulp');
var merge = require('merge-stream');
var sass = require('gulp-sass');
var inject = require('gulp-inject');
var wiredep = require('wiredep').stream;
var del = require('del');
var uglify = require('gulp-uglify');
var cleanCSS = require('gulp-clean-css');

gulp.task('clean', function (cb) {
    del(['assets-dist'], cb);
});

gulp.task('styles', ['clean'], function() {
    var injectAppFiles = gulp.src('assets-src/styles/*.scss', {read: false});
    var injectGlobalFiles = gulp.src('assets-src/global/*.scss', {read: false});

    function transformFilepath(filepath) {
    return '@import "' + filepath + '";';
    };

    var injectAppOptions = {
    transform: transformFilepath,
    starttag: '// inject:app',
    endtag: '// endinject',
    addRootSlash: false
    };

    var injectGlobalOptions = {
    transform: transformFilepath,
    starttag: '// inject:global',
    endtag: '// endinject',
    addRootSlash: false
    };

    return gulp.src('assets-src/main.scss')
    .pipe(wiredep())
    .pipe(inject(injectGlobalFiles, injectGlobalOptions))
    .pipe(inject(injectAppFiles, injectAppOptions))
    .pipe(sass())
    .pipe(cleanCSS({compatibility: 'ie8'}))
    .pipe(gulp.dest('assets-dist/css'));
});


gulp.task('js', ['clean'], function() {
    var bootstrap = gulp.src(
    ['bower_components/bootstrap-sass/assets/javascripts/bootstrap.js',
    ])
    .pipe(uglify())
    .pipe(gulp.dest('assets-dist/js'));

    var misc = gulp.src(['assets-src/js/*.js'])
        .pipe(uglify())
        .pipe(gulp.dest('assets-dist/js'));

    return merge(bootstrap, misc);
});


gulp.task('bootstrapfonts', ['clean'], function() {
   gulp.src('bower_components/bootstrap-sass/assets/fonts/bootstrap/*.{ttf,woff,woff2,eot,svg}')
   .pipe(gulp.dest('assets-dist/fonts/bootstrap'));
});


gulp.task('images', ['clean'], function() {
   gulp.src('assets-src/images/**/*.{jpg,png,svg,ico}')
   .pipe(gulp.dest('assets-dist/images'));
});


gulp.task('default', ['styles', 'js', 'images', 'bootstrapfonts'], function() {
    var injectFiles = gulp.src(['assets-dist/css/main.css']);

    var injectOptions = {
    addRootSlash: false,
    ignorePath: ['src', 'dist']
    };

    return gulp.src('src/index.html')
    .pipe(inject(injectFiles, injectOptions))
    .pipe(gulp.dest('dist'));
});

package.json:

{
  "name": "LoreIpsum",
  "version": "1.0.0",
  "description": "Lorem ipsum",
  "main": "index.js",
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "bower": "^1.7.9",
    "del": "^1.2.0",
    "gulp": "^3.9.1",
    "gulp-clean-css": "^2.0.12",
    "gulp-inject": "^4.1.0",
    "gulp-sass": "^2.3.2",
    "gulp-uglify": "^1.5.4",
    "gulp-uncss": "^1.0.6",
    "merge-stream": "^1.0.0",
    "wiredep": "^4.0.0"
  },
  "dependencies": {
  }
}

Output:

nine at nine-thinkpad in ~/Dev/Hemsidor/WebApp (python3●●) (WebApp) 
$ node_modules/.bin/gulp --version
[22:22:55] CLI version 3.9.1
[22:22:55] Local version 3.9.1

nine at nine-thinkpad in ~/Dev/Hemsidor/WebApp (python3●●) (Webapp) 
$ node_modules/.bin/gulp default  
[22:23:02] Using gulpfile ~/Dropbox/Dev/Hemsidor/Webapp/gulpfile.js
[22:23:02] Starting 'clean'...
Niclas Nilsson
  • 5,691
  • 3
  • 30
  • 43
  • Please provide the output of gulp, and which version you are actually using. With CLI/Local version 3.9.1 using your files I got all tasks executed. – Luca Cappa Jan 06 '17 at 21:11
  • @LucaCappa That is strange! I updated my question with yhe output. – Niclas Nilsson Jan 06 '17 at 21:25
  • is that the complete output? you should at least get a line of text saying "Finished 'clean'...". Perhaps clearing the cache could help? `npm clear cache`, then `npm install` again would pull down everything again – Luca Cappa Jan 06 '17 at 21:34
  • del 1.x is used here, the callback is not an issue. What about the 'Dropbox' path? @niclas-nilsson is that expected? – Luca Cappa Jan 07 '17 at 05:46
  • @LucaCappa It was the complete output and the problem was the version of del. I had tried to update all my libraries but when that didn't work I thought i reverted when I deleted the node_modules directory and run `npm install` again on the old version of package.json file. – Niclas Nilsson Jan 07 '17 at 08:44

0 Answers0