Gulp构建不生成任何文件

时间:2018-02-16 20:12:08

标签: sass gulp gulp-uglify gulp-concat gulp-minify-css

我正在使用以下gulp代码来构建我的部署文件。

var gulp = require('gulp');
var concat = require('gulp-concat');
var minify = require('gulp-minify');
var cleanCss = require('gulp-clean-css');

gulp.task('pack-js', function () {  
    return gulp.src([
        'wp_theme/assets/js/jquery-3.1.1.min.js', 
        'wp_theme/assets/js/bootstrap.min.js', 
        'wp_theme/assets/js/assets/js/device.min.js',
        'wp_theme/assets/js/app.js'
    ])
        .pipe(concat('app-min.js'))
        .pipe(minify())
        .pipe(gulp.dest('./dist/'));
});

gulp.task('pack-css', function () { 
    return gulp.src([
        'wp_theme/assets/css/normalize.css', 
        'wp_theme/assets/css/bootstrap.min.css',
        'wp_theme/assets/js/slick/slick.css',
        'wp_theme/assets/js/slick/slick-theme.css',
        'wp_theme/assets/css/animate.min.css',
        'wp_theme/assets/fonts/font-awesome/css/font-awesome.css',
        'wp_theme/assets/fonts/font-awesome/css/font-awesome.min.css',
        'wp_theme/style.css',
    ])
        .pipe(concat('style.css'))
        .pipe(cleanCss())
   .pipe(gulp.dest('./dist/'));
});

gulp.task('default', ['pack-js', 'pack-css']);

接下来,当我运行“gulp”命令时,我没有收到任何错误

$ gulp
[01:34:53] Using gulpfile ~/{directory path here}/gulpfile.js
[01:34:53] Starting 'pack-js'...
[01:34:53] Starting 'pack-css'...
[01:34:53] Finished 'pack-js' after 28 ms
[01:34:53] Finished 'pack-css' after 13 ms
[01:34:53] Starting 'default'...
[01:34:53] Finished 'default' after 39 μs

但是在“dist”文件夹中,与“gulpfile.js”位于同一目录中并不显示任何生成的文件。

我也检查了版本。

$ gulp -v
[08:01:40] CLI version 3.9.1
[08:01:40] Local version 3.9.1

我在这里做错了什么?

0 个答案:

没有答案