2016-01-31 14:24:53 +00:00
|
|
|
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');
|
2016-02-06 17:14:41 +00:00
|
|
|
require('./release');
|
2016-01-31 14:24:53 +00:00
|
|
|
|
|
|
|
gulp.task('fonts', function() {
|
|
|
|
gulp.src('./node_modules/bootstrap-sass/assets/fonts/bootstrap/*')
|
2016-02-02 19:13:07 +00:00
|
|
|
.pipe(gulp.dest('./static/fonts'));
|
2016-01-31 14:24:53 +00:00
|
|
|
});
|
|
|
|
|
2016-02-06 15:10:42 +00:00
|
|
|
gulp.task('css', function() {
|
|
|
|
return gulp.src('./static/css/theme.scss')
|
2016-01-31 14:24:53 +00:00
|
|
|
.pipe(sass().on('error', handleError))
|
2016-02-06 15:10:42 +00:00
|
|
|
.pipe(gulp.dest('./static/css'))
|
|
|
|
.pipe(cssnano())
|
|
|
|
.pipe(rename({ suffix: '.min' }))
|
2016-02-02 19:13:07 +00:00
|
|
|
.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'));
|
|
|
|
});
|
|
|
|
|
2016-02-04 21:33:40 +00:00
|
|
|
gulp.task('watch', function() {
|
2016-02-06 15:10:42 +00:00
|
|
|
gulp.watch('./static/**/*.scss', ['css']);
|
|
|
|
gulp.watch('./static/**/*.js', ['js']);
|
2016-02-04 21:33:40 +00:00
|
|
|
});
|
|
|
|
|
2016-02-02 19:13:07 +00:00
|
|
|
gulp.task('default', function() {
|
2016-02-06 15:10:42 +00:00
|
|
|
gulp.start('fonts', 'css', 'js');
|
2016-01-31 14:24:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function handleError(err) {
|
|
|
|
gutil.log(err);
|
|
|
|
this.emit('end');
|
|
|
|
}
|