fixed build
This commit is contained in:
parent
83db4cf10c
commit
1b4a4134fe
2 changed files with 1 additions and 75 deletions
69
gulpfile.js
69
gulpfile.js
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
var settings = {
|
||||
clean: true,
|
||||
scripts: true,
|
||||
styles: true,
|
||||
copy: true,
|
||||
reload: true
|
||||
|
@ -17,10 +16,6 @@ var settings = {
|
|||
var paths = {
|
||||
input: 'src/',
|
||||
output: 'dist/',
|
||||
scripts: {
|
||||
input: 'src/js/*.js',
|
||||
output: 'dist/js/'
|
||||
},
|
||||
styles: {
|
||||
input: 'src/scss/*.scss',
|
||||
output: 'dist/css/'
|
||||
|
@ -59,17 +54,10 @@ var banner = {
|
|||
// General
|
||||
var {src, dest, watch, series, parallel} = require('gulp');
|
||||
var del = require('del');
|
||||
var flatmap = require('gulp-flatmap');
|
||||
var lazypipe = require('lazypipe');
|
||||
var rename = require('gulp-rename');
|
||||
var header = require('gulp-header');
|
||||
var package = require('./package.json');
|
||||
|
||||
// Scripts
|
||||
var concat = require('gulp-concat');
|
||||
var uglify = require('gulp-terser');
|
||||
var optimizejs = require('gulp-optimize-js');
|
||||
|
||||
// Styles
|
||||
var sass = require('gulp-sass')(require('sass'));
|
||||
var postcss = require('gulp-postcss');
|
||||
|
@ -100,62 +88,6 @@ var cleanDist = function (done) {
|
|||
|
||||
};
|
||||
|
||||
// Repeated JavaScript tasks
|
||||
var jsTasks = lazypipe()
|
||||
.pipe(header, banner.main, {package: package})
|
||||
.pipe(optimizejs)
|
||||
.pipe(dest, paths.scripts.output)
|
||||
.pipe(rename, {suffix: '.min'})
|
||||
.pipe(uglify)
|
||||
.pipe(optimizejs)
|
||||
.pipe(header, banner.main, {package: package})
|
||||
.pipe(dest, paths.scripts.output);
|
||||
|
||||
// minify, and concatenate scripts
|
||||
var buildScripts = function (done) {
|
||||
// Make sure this feature is activated before running
|
||||
if (!settings.scripts) return done();
|
||||
|
||||
// Run tasks on script files
|
||||
return src(paths.scripts.input)
|
||||
.pipe(flatmap(function(stream, file) {
|
||||
|
||||
// If the file is a directory
|
||||
if (file.isDirectory()) {
|
||||
|
||||
// Setup a suffix variable
|
||||
var suffix = '';
|
||||
|
||||
// If separate polyfill files enabled
|
||||
if (settings.polyfills) {
|
||||
|
||||
// Update the suffix
|
||||
suffix = '.polyfills';
|
||||
|
||||
// Grab files that aren't polyfills, concatenate them, and process them
|
||||
src([file.path + '/*.js', '!' + file.path + '/*' + paths.scripts.polyfills])
|
||||
.pipe(concat(file.relative + '.js'))
|
||||
.pipe(jsTasks());
|
||||
|
||||
}
|
||||
|
||||
// Grab all files and concatenate them
|
||||
// If separate polyfills enabled, this will have .polyfills in the filename
|
||||
src(file.path + '/*.js')
|
||||
.pipe(concat(file.relative + suffix + '.js'))
|
||||
.pipe(jsTasks());
|
||||
|
||||
return stream;
|
||||
|
||||
}
|
||||
|
||||
// Otherwise, process the file
|
||||
return stream.pipe(jsTasks());
|
||||
|
||||
}));
|
||||
|
||||
};
|
||||
|
||||
// Process, and minify Sass files
|
||||
var buildStyles = function (done) {
|
||||
// Make sure this feature is activated before running
|
||||
|
@ -239,7 +171,6 @@ var watchSource = function (done) {
|
|||
exports.default = series(
|
||||
cleanDist,
|
||||
parallel(
|
||||
buildScripts,
|
||||
buildStyles,
|
||||
copyFiles
|
||||
)
|
||||
|
|
|
@ -17,17 +17,12 @@
|
|||
"devDependencies": {
|
||||
"autoprefixer": "10.4.19",
|
||||
"cssnano": "6.1.2",
|
||||
"del": "6.1.1",
|
||||
"del": "7.1.0",
|
||||
"gulp": "5.0.0",
|
||||
"gulp-concat": "2.6.1",
|
||||
"gulp-flatmap": "1.0.2",
|
||||
"gulp-header": "2.0.9",
|
||||
"gulp-optimize-js": "1.1.0",
|
||||
"gulp-postcss": "10.0.0",
|
||||
"gulp-rename": "2.0.0",
|
||||
"gulp-sass": "5.1.0",
|
||||
"gulp-terser": "2.1.0",
|
||||
"lazypipe": "1.0.2",
|
||||
"node-sass-tilde-importer": "^1.0.2",
|
||||
"postcss": "^8.4.38",
|
||||
"sass": "^1.74.1"
|
||||
|
|
Loading…
Reference in a new issue