Skip to content

Instantly share code, notes, and snippets.

@branneman
Last active October 14, 2015 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save branneman/c7c52fe54ac880f08a9f to your computer and use it in GitHub Desktop.
Save branneman/c7c52fe54ac880f08a9f to your computer and use it in GitHub Desktop.
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