Instantly share code, notes, and snippets.

Embed
What would you like to do?
var gulp = require('gulp');
require('./tasks-css');
require('./tasks-js');
// etc.
gulp.task('dev', ['browsersync', 'html-watch', 'img-watch', 'css-watch', 'js-watch']);
gulp.task('dist', ['clean', 'html-compile', 'img-optimize', 'css-compile', 'js-transpile']);
// etc.
var config = require('./config');
var gulp = require('gulp');
var watch = require('gulp-watch');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
/**
* Task: CSS Compile
*/
gulp.task('css-compile', function() {
gulp.src(config.paths.css.globStatic)
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(postcss([autoprefixer()]]))
.pipe(minifyCss())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(config.paths.css.dirDist));
});
/**
* Task: CSS Watch
*/
gulp.task('css-watch', ['css-compile'], function() {
watch([config.paths.css.globWatch], function() {
gulp.start(['css-compile']);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment