Created
December 19, 2014 16:49
-
-
Save peterkos/ded1dc4d5232936e8873 to your computer and use it in GitHub Desktop.
My Gulpfile used for a variety of projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)