2015-07-19 02:20:09 +02:00
|
|
|
var gulp = require('gulp'),
|
|
|
|
less = require('gulp-less'),
|
|
|
|
rename = require('gulp-rename'),
|
2020-04-16 23:49:09 +02:00
|
|
|
cssnano = require('gulp-cssnano'),
|
|
|
|
uglify = require('gulp-uglify');
|
2015-07-19 02:20:09 +02:00
|
|
|
|
|
|
|
gulp.task('less', function () {
|
2020-04-16 00:55:28 +02:00
|
|
|
return gulp.src([
|
2020-04-16 23:49:09 +02:00
|
|
|
'./static/stylesheet/dark-theme.less',
|
2020-04-16 00:55:28 +02:00
|
|
|
'./static/stylesheet/style.less',
|
|
|
|
])
|
2015-07-19 02:20:09 +02:00
|
|
|
.pipe(less())
|
2020-04-16 23:49:09 +02:00
|
|
|
.pipe(cssnano())
|
2015-10-07 02:19:34 +02:00
|
|
|
.pipe(rename({
|
|
|
|
extname: '.min.css'
|
|
|
|
}))
|
2016-02-22 19:52:48 +01:00
|
|
|
.pipe(gulp.dest('./static/stylesheet'));
|
2015-07-19 02:20:09 +02:00
|
|
|
});
|
|
|
|
|
2020-04-16 23:49:09 +02:00
|
|
|
gulp.task('uglify', function () {
|
2020-04-20 22:56:30 +02:00
|
|
|
return gulp.src('./static/dark-theme/dark-theme.js')
|
2020-04-16 23:49:09 +02:00
|
|
|
.pipe(uglify())
|
|
|
|
.pipe(rename({
|
|
|
|
extname: '.min.js'
|
|
|
|
}))
|
2020-04-20 22:56:30 +02:00
|
|
|
.pipe(gulp.dest('./static/dark-theme'));
|
2020-04-16 23:49:09 +02:00
|
|
|
});
|
|
|
|
|
2016-04-23 08:14:54 +02:00
|
|
|
gulp.task('cp', function () {
|
|
|
|
return gulp.src('./node_modules/font-awesome/**/*.{min.css,otf,eot,svg,ttf,woff,woff2}')
|
|
|
|
.pipe(gulp.dest('./static/font-awesome'));
|
|
|
|
});
|
|
|
|
|
2016-04-24 00:44:16 +02:00
|
|
|
gulp.task('pygments', function () {
|
|
|
|
return gulp.src(['./static/pygments/*.css', '!./static/pygments/*min.css'])
|
2020-04-16 23:49:09 +02:00
|
|
|
.pipe(cssnano())
|
2016-04-24 00:44:16 +02:00
|
|
|
.pipe(rename({
|
|
|
|
extname: '.min.css'
|
|
|
|
}))
|
|
|
|
.pipe(gulp.dest('./static/pygments'));
|
|
|
|
});
|
|
|
|
|
2020-05-12 15:15:39 +02:00
|
|
|
gulp.task('watch-less', function () {
|
|
|
|
return gulp.watch('static/stylesheet/*.less', gulp.task('less'));
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('watch-js', function () {
|
|
|
|
return gulp.watch('static/dark-theme/!(*.min).js', gulp.task('uglify'));
|
|
|
|
})
|
2016-04-24 00:44:16 +02:00
|
|
|
|
2020-04-16 23:49:09 +02:00
|
|
|
gulp.task('default', gulp.series(['less', 'uglify', 'cp', 'pygments']));
|
2020-05-12 15:15:39 +02:00
|
|
|
|
|
|
|
gulp.task('watch', gulp.series('default', gulp.parallel('watch-less', 'watch-js')));
|