-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gulp support (not fully working yet)
- Loading branch information
Showing
7 changed files
with
11,364 additions
and
218 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const gulp = require('gulp'); | ||
const terser = require('gulp-terser'); | ||
const concat = require('gulp-concat'); | ||
const cleanCSS = require('gulp-clean-css'); | ||
const htmlmin = require('gulp-html-minifier-terser'); | ||
const rename = require('gulp-rename'); | ||
const htmlreplace = require('gulp-html-replace'); | ||
|
||
|
||
gulp.task('pack-css', async function () { | ||
return gulp.src(['./assets/styles/spectre.css/spectre-modified.css', './assets/styles/style.css']) | ||
.pipe(concat('style.main.css')) | ||
.pipe(cleanCSS({ | ||
level: 2 | ||
})) | ||
.pipe(gulp.dest('./assets/bundles/')) | ||
.pipe(gulp.dest('./dist/assets/')); | ||
}); | ||
|
||
gulp.task('pack-js', async function() { | ||
gulp.src(['./assets/js/function.js', './assets/js/iconfont.js']) | ||
.pipe(concat('function.main.js')) | ||
.pipe(terser()) | ||
.pipe(gulp.dest('./assets/bundles/')) | ||
.pipe(gulp.dest('./dist/assets/')); | ||
}); | ||
|
||
gulp.task('minify-html', async function() { | ||
gulp.src(['./build/merger.html']) | ||
.pipe(htmlmin({ | ||
collapseWhitespace: true, | ||
conservativeCollapse: true, | ||
collapseInlineTagWhitespace: true, | ||
collapseBooleanAttributes: true, | ||
removeComments: true, | ||
minifyCSS: true, | ||
minifyJS: true, | ||
removeRedundantAttributes: true, | ||
removeScriptTypeAttributes: true, | ||
removeStyleLinkTypeAttributes: true, | ||
useShortDoctype: true, | ||
sortAttributes: true, | ||
sortClassName: true, | ||
})) | ||
.pipe(rename('index.html')) | ||
.pipe(gulp.dest('build/')); | ||
}); | ||
|
||
gulp.task('replace-js-css', async function() { | ||
gulp.src('./merger.html') | ||
.pipe(htmlreplace({ | ||
'css': '/assets/style.main.css', | ||
'js': '/assets/function.main.js' | ||
})) | ||
// .pipe(rename('index.html')) | ||
.pipe(gulp.dest('build/')) | ||
}); | ||
|
||
gulp.task('compile', gulp.parallel('pack-css', 'pack-js')); | ||
gulp.task('default', gulp.series('replace-js-css', 'minify-html')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.