Skip to content

Instantly share code, notes, and snippets.

@peterkos
Created December 19, 2014 16:49
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 peterkos/ded1dc4d5232936e8873 to your computer and use it in GitHub Desktop.
Save peterkos/ded1dc4d5232936e8873 to your computer and use it in GitHub Desktop.
My Gulpfile used for a variety of projects
var gulp = require('gulp');
var rename = require('gulp-rename');
var browserSync = require('browser-sync');
var notify = require('gulp-notify');
var sass = require('gulp-sass');
var minifycss = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: "../"
}
});
});
gulp.task('styles', function() {
return gulp.src('../scss/styles.scss')
//Parse
.pipe(sass({ style: 'expanded' }))
.pipe(autoprefixer('last 4 versions'))
.pipe(gulp.dest('../css'))
//Minify
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('../css'))
//Reload
// .pipe(notify({ message: 'Styles task complete' }));
});
// Default task to be run with gulp
gulp.task('default', ['styles', 'browser-sync'], function () {
gulp.watch("../scss/*.scss", ['styles', browserSync.reload]);
});
@peterkos
Copy link
Author

Note: gulp is run from a separate directory gulp -- not from the root of the project. (That's why the gulp.dest is usually a folder out)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment