Created
January 22, 2016 13:49
-
-
Save keeprock/eb0243922d5062dadea5 to your computer and use it in GitHub Desktop.
Latest working gulpfile config
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'), | |
sass = require('gulp-ruby-sass'), | |
sourcemaps = require('gulp-sourcemaps'), | |
prefix = require('gulp-autoprefixer'), | |
watch = require('gulp-watch'), | |
plumber = require('gulp-plumber'), | |
filter = require('gulp-filter'), | |
browserSync = require('browser-sync'), | |
reload = browserSync.reload; | |
var path = { | |
build: { | |
css: 'web/css' | |
}, | |
src: { | |
style: 'assets/sass/main.scss' | |
}, | |
watch: { | |
style: 'assets/sass/**/*.scss', | |
views: 'views/**/*.php' | |
} | |
} | |
gulp.task('style:build', function() { | |
sass(path.src.style, {sourcemap: true}) | |
.on('error', function(err){ | |
console.log('Error!', err.message); | |
}) | |
.pipe(prefix("last 2 versions")) | |
.pipe(sourcemaps.write('.')) | |
.pipe(gulp.dest(path.build.css)) | |
.pipe(filter('**/*.css')) | |
.pipe(reload({stream:true})); | |
//gulp.src(path.src.style) | |
// .pipe(sourcemaps.init()) | |
// .pipe(sass()) | |
// .pipe(prefixer()) | |
// .pipe(cssmin()) | |
// .pipe(sourcemaps.write()) | |
// .pipe(gulp.dest(path.build.css)) | |
}); | |
gulp.task('build', [ | |
'style:build' | |
], function(){ | |
browserSync.init({ | |
proxy: "http://lk.app:80", | |
}); | |
}); | |
gulp.task('watch', function(){ | |
watch([path.watch.style], function(event, cb) { | |
gulp.start('style:build'); | |
}); | |
watch([path.watch.views], reload); | |
}); | |
gulp.task('default', ['build', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment