2015-04-15 05:35:43 +08:00
|
|
|
var gulp = require('gulp');
|
|
|
|
var less = require('gulp-less');
|
|
|
|
var path = require('path');
|
|
|
|
var minifyCSS = require('gulp-minify-css');
|
|
|
|
var rename = require('gulp-rename');
|
2015-04-16 05:32:16 +08:00
|
|
|
var sourcemaps = require('gulp-sourcemaps');
|
2015-04-22 05:46:22 +08:00
|
|
|
|
|
|
|
// now some dev nice utilities.
|
|
|
|
var livereload = require('gulp-livereload');
|
2015-04-15 05:35:43 +08:00
|
|
|
|
2015-04-16 05:32:16 +08:00
|
|
|
gulp.task('css', function () {
|
2015-05-14 01:56:32 +08:00
|
|
|
return gulp.src('./notebook/static/style/*.less')
|
2015-04-16 05:32:16 +08:00
|
|
|
.pipe(sourcemaps.init())
|
2015-04-15 05:35:43 +08:00
|
|
|
.pipe(less({
|
|
|
|
paths: [ path.join(__dirname, 'less', 'includes') ]
|
|
|
|
}))
|
2015-05-09 07:46:09 +08:00
|
|
|
.pipe(minifyCSS({restructuring: false}))
|
2015-04-15 05:35:43 +08:00
|
|
|
.pipe(rename({
|
|
|
|
suffix: '.min'
|
|
|
|
}))
|
2015-04-21 03:15:05 +08:00
|
|
|
.pipe(sourcemaps.write('./'))
|
2015-05-14 01:56:32 +08:00
|
|
|
.pipe(gulp.dest('./notebook/static/style'))
|
2015-04-22 05:46:22 +08:00
|
|
|
.pipe(livereload());
|
2015-04-15 05:35:43 +08:00
|
|
|
});
|
2015-04-16 05:32:16 +08:00
|
|
|
|
2015-04-22 05:46:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
gulp.task('watch', function() {
|
|
|
|
livereload.listen();
|
2015-05-14 01:56:32 +08:00
|
|
|
gulp.watch('notebook/static/**/*.less', ['css']);
|
2015-04-22 05:46:22 +08:00
|
|
|
});
|