cleaner build pipe + ES6
The thing is broken tho
This commit is contained in:
21
gulpfile.js
21
gulpfile.js
@@ -2,9 +2,13 @@ const { src, dest, parallel, series, watch } = require('gulp');
|
||||
const autoprefixer = require('gulp-autoprefixer');
|
||||
const minify = require('gulp-minify');
|
||||
const cleanCSS = require('gulp-clean-css');
|
||||
const fs = require('fs');
|
||||
const del = require('del');
|
||||
const rename = require('gulp-rename');
|
||||
const htmlMin = require('gulp-htmlmin');
|
||||
const sass = require('gulp-sass');
|
||||
const replace = require('gulp-replace');
|
||||
//
|
||||
function html() {
|
||||
return src('./src/html/component.html')
|
||||
.pipe(htmlMin({ collapseWhitespace: true }))
|
||||
@@ -19,5 +23,18 @@ function css() {
|
||||
.pipe(rename('./src/css/component-min.css'))
|
||||
.pipe(dest('./'));
|
||||
}
|
||||
const js = () => src('./src/js/mailymaily.js').pipe(minify({ noSource: true })).pipe(dest('./dist'));
|
||||
exports.default = series(parallel(html, css), js);
|
||||
function js() {
|
||||
const css = fs.readFileSync('./src/css/component-min.css');
|
||||
const html = fs.readFileSync('./src/html/component-min.html');
|
||||
return (
|
||||
src('./src/js/mailymaily.js')
|
||||
.pipe(replace(/___css_inserter___/g, css))
|
||||
.pipe(replace(/___html_inserter___/g, html))
|
||||
// .pipe(minify({ noSource: true }))
|
||||
.pipe(dest('./dist'))
|
||||
);
|
||||
}
|
||||
function clean() {
|
||||
return del([ './src/html/component-min.html', './src/css/' ]);
|
||||
}
|
||||
exports.default = series(html, css, js, clean);
|
||||
|
||||
Reference in New Issue
Block a user