Created
September 27, 2017 07:44
-
-
Save suryanto/aa227c56d9eb43984af14e9ca5bff342 to your computer and use it in GitHub Desktop.
contoh gulpfile
This file contains 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 $ = require('gulp-load-plugins')(); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var browserSync = require("browser-sync").create(); | |
var reload = browserSync.reload; | |
var sassPaths = [ | |
]; | |
gulp.task('sass', function() { | |
return gulp.src('scss/training.scss') | |
.pipe(sourcemaps.init()) | |
.pipe($.sass({ | |
//includePaths: sassPaths, | |
includePaths: [], | |
outputStyle: 'expanded' // if css compressed **file size** | |
}) | |
.on('error', $.sass.logError)) | |
.pipe($.autoprefixer({ | |
browsers: ['last 2 versions', 'ie >= 9'] | |
})) | |
.pipe(sourcemaps.write()) | |
.pipe(gulp.dest('css')) | |
.pipe(browserSync.reload({stream:true})); | |
}); | |
// Watch scss folder for changes | |
gulp.task('watch', function() { | |
// Watches the scss folder for all .scss and .sass files | |
// If any file changes, run the sass task | |
browserSync.init({ | |
proxy: "trainingmodule.dev" | |
}); | |
gulp.watch('./scss/**/*.{scss,sass}', gulp.series('sass')); | |
}); | |
// Creating a default task | |
gulp.task('default', gulp.series('sass', 'watch')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment