mirror of
https://github.com/ViViDboarder/Vivid-Casper.git
synced 2024-10-31 18:36:31 +00:00
397a096949
Avoid using "public" because it's a reserved word by the asset helper
55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
var gulp = require('gulp');
|
|
|
|
// gulp plugins and utils
|
|
var gutil = require('gulp-util');
|
|
var livereload = require('gulp-livereload');
|
|
var nodemon = require('gulp-nodemon');
|
|
var postcss = require('gulp-postcss');
|
|
var sourcemaps = require('gulp-sourcemaps');
|
|
|
|
// postcss plugins
|
|
var autoprefixer = require('autoprefixer');
|
|
var colorFunction = require('postcss-color-function');
|
|
var cssnano = require('cssnano');
|
|
var customProperties = require('postcss-custom-properties');
|
|
var easyimport = require('postcss-easy-import');
|
|
|
|
var swallowError = function swallowError(error) {
|
|
gutil.log(error.toString());
|
|
gutil.beep();
|
|
this.emit('end');
|
|
};
|
|
|
|
var nodemonServerInit = function () {
|
|
livereload.listen(1234);
|
|
};
|
|
|
|
gulp.task('build', ['css'], function (/* cb */) {
|
|
return nodemonServerInit();
|
|
});
|
|
|
|
gulp.task('css', function () {
|
|
var processors = [
|
|
easyimport,
|
|
customProperties,
|
|
colorFunction(),
|
|
autoprefixer({browsers: ['last 2 versions']}),
|
|
cssnano()
|
|
];
|
|
gulp.src('assets/css/*.css')
|
|
.on('error', swallowError)
|
|
.pipe(sourcemaps.init())
|
|
.pipe(postcss(processors))
|
|
.pipe(sourcemaps.write('.'))
|
|
.pipe(gulp.dest('assets/built/'))
|
|
.pipe(livereload());
|
|
});
|
|
|
|
gulp.task('watch', function () {
|
|
gulp.watch('assets/css/**', ['css']);
|
|
});
|
|
|
|
gulp.task('default', ['build'], function () {
|
|
gulp.start('watch');
|
|
});
|