Created
March 18, 2016 15:54
-
-
Save dpineiden/b14f153e4884e17b847d to your computer and use it in GitHub Desktop.
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 path = require('path'); | |
var sass = require('gulp-sass'); | |
var watch = require('gulp-watch'); | |
var minifycss = require('gulp-clean-css'); | |
var rename = require('gulp-rename'); | |
var gzip = require('gulp-gzip'); | |
var browserSync = require('browser-sync'); | |
var reload = browserSync.reload; | |
var gzip_options = { | |
threshold: '1kb', | |
gzipOptions: { | |
level: 9 | |
} | |
}; | |
var sassDir = './mjd/apps/' | |
/* Compile Our Sass */ | |
gulp.task('sass', function() { | |
return gulp.src(sassDir+'**/static/scss/*.scss') | |
.pipe(sass()) | |
// .pipe(parsePath()) | |
.pipe( | |
rename(function(path){ | |
path.dirname += "/../css"; | |
}) | |
) | |
.pipe(gulp.dest(sassDir)) | |
.pipe(rename({suffix: '.min'})) | |
.pipe(minifycss()) | |
.pipe(gulp.dest(sassDir)) | |
.pipe(gzip(gzip_options)) | |
.pipe(gulp.dest(sassDir)) | |
//.pipe(livereload()) | |
}); | |
/* Watch Files For Changes */ | |
gulp.task('watch', function() { | |
//livereload.listen(10000); | |
gulp.watch('**/static/scss/*.scss', ['sass']); | |
/* Trigger a live reload on any Django template changes */ | |
browserSync.init({ | |
notify: false, | |
proxy: "localhost:8000" | |
}); | |
gulp.watch(['./**/*.{scss,css,html,py,js}'], reload); | |
}); | |
gulp.task('default', ['sass', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment