hugo-code-editor-theme/gulpfile.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
2016-02-06 15:10:42 +00:00
var cssnano = require('gulp-cssnano');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
require('./release');
gulp.task('fonts', function() {
gulp.src('./node_modules/bootstrap-sass/assets/fonts/bootstrap/*')
.pipe(gulp.dest('./static/fonts'));
});
2016-02-06 15:10:42 +00:00
gulp.task('css', function() {
return gulp.src('./static/css/theme.scss')
.pipe(sass().on('error', handleError))
2016-02-06 15:10:42 +00:00
.pipe(gulp.dest('./static/css'))
.pipe(cssnano())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./static/css'));
});
2016-02-06 15:10:42 +00:00
gulp.task('js', function() {
return gulp.src('./static/js/!(theme.js|theme.min.js)')
.pipe(concat('theme.js'))
.pipe(gulp.dest('./static/js'))
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./static/js'));
});
gulp.task('watch', function() {
2016-02-06 15:10:42 +00:00
gulp.watch('./static/**/*.scss', ['css']);
gulp.watch('./static/**/*.js', ['js']);
});
gulp.task('default', function() {
2016-02-06 15:10:42 +00:00
gulp.start('fonts', 'css', 'js');
});
function handleError(err) {
gutil.log(err);
this.emit('end');
}