summaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authoramzrk22020-06-01 15:44:04 +0800
committeramzrk22020-06-01 15:44:04 +0800
commit02c3891865c7741b8f772aea75cc01564d2f0ff4 (patch)
treedb0e4dd8c3ef95181f5e665ca09f731b75de0387 /gulpfile.js
parent2338da969d3bc1b2bc26df9f7192dd20a0906c5b (diff)
downloadhugo-theme-fuji-02c3891865c7741b8f772aea75cc01564d2f0ff4.tar.gz
hugo-theme-fuji-02c3891865c7741b8f772aea75cc01564d2f0ff4.tar.bz2
hugo-theme-fuji-02c3891865c7741b8f772aea75cc01564d2f0ff4.zip
Remove jQuery
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644
index 0000000..26c508d
--- /dev/null
+++ b/gulpfile.js
@@ -0,0 +1,45 @@
+var pipeline = require('readable-stream').pipeline;
+var gulp = require('gulp');
+var sourcemaps = require('gulp-sourcemaps');
+var babel = require('gulp-babel');
+var uglify = require('gulp-uglify');
+var sass = require('gulp-sass');
+sass.compiler = require('node-sass');
+var postcss = require('gulp-postcss');
+var autoprefixer = require('autoprefixer');
+var cssnano = require('cssnano');
+var rename = require('gulp-rename');
+
+function js() {
+ return pipeline(
+ gulp.src('assets/js/fuji.js'),
+ sourcemaps.init(),
+ babel({
+ presets: ['@babel/env'],
+ }),
+ uglify(),
+ rename({ suffix: '.min' }),
+ sourcemaps.write('.'),
+ gulp.dest('static/assets/js/')
+ );
+}
+
+function css() {
+ return pipeline(
+ gulp.src('assets/scss/fuji.scss'),
+ sourcemaps.init(),
+ sass(),
+ postcss([autoprefixer(), cssnano()]),
+ rename({ suffix: '.min' }),
+ sourcemaps.write('.'),
+ gulp.dest('static/assets/css/')
+ );
+}
+
+exports.build = gulp.parallel(js, css);
+exports.devJs = function () {
+ return gulp.watch('assets/js/fuji.js', { delay: 500 }, gulp.parallel(js));
+};
+exports.devCss = function () {
+ return gulp.watch(['assets/scss/*.scss', 'assets/scss/*/*.scss'], { delay: 500 }, gulp.parallel(css));
+};