1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| var gulp = require('gulp'), concat = require('gulp-concat'), merge = require('merge-stream'), preprocess = require('gulp-preprocess'), cssmin = require('gulp-clean-css'), sass = require('gulp-sass'), sassImport = require('gulp-sass-import'), rename = require('gulp-rename'), del = require('del'), runSequence = require('run-sequence'); gulp.task('clean', function(cb) { return del("dist", cb); }) gulp.task('bower', function(cb) { return gulp.src('bower_components/**') .pipe(gulp.dest('dist/bower_components')); }) gulp.task('css', function(cb) { return gulp.src(['**/**/*.css', '!bower_components/**', '!node_modules/**', '!src/plugin/**']) .pipe(cssmin({ advanced: true, compatibility: '', keepBreaks: false, keepSpecialComments: '*' })) .pipe(gulp.dest('dist/')); }) gulp.task('sass', function(cb) { return gulp.src(['**/**/*.scss', '!bower_components/**', '!node_modules/**', '!src/plugin/**']) .pipe(sassImport({ filename: '_file', })) .pipe(sass().on('error', sass.logError)) .pipe(cssmin({ advanced: true, compatibility: '', keepBreaks: false, keepSpecialComments: '*' })) .pipe(gulp.dest('dist/')); }) gulp.task('html', function(cb) { return gulp.src(['**/**/*.html', '!src/plugin']) .pipe(gulp.dest('dist/')); }) gulp.task('image', function(cb) { return gulp.src(['**/**/*.png', '**/**/*.jpg', '!bower_components/**', '!node_modules/**', '!src/plugin/**']) .pipe(gulp.dest('dist/')) }) var folders=[]; gulp.task('js', function(cb) { var tasks = folders.map(function(element) { return gulp.src(element + '/**/*.js') .pipe(concat('all.js')) .pipe(gulp.dest("dist/" + element)) }); return merge(tasks); }); gulp.task('env', function(cb) { var env1 = process.env.NODE_ENV || 'dev'; console.log(process.argv); return gulp.src('env/env.' + env1 + '.js') .pipe(concat('env.js')) .pipe(gulp.dest('dist/env')); });
const { series, parallel } = require('gulp'); exports.default = series('clean', parallel('bower', 'image', 'css', 'sass', 'html', 'env', 'js')); var logger = function(msg) { console.log(msg); };
|