Created
January 30, 2019 19:02
-
-
Save erkanunluturk/2198826fd2e2f126e4e48f23c1d353e2 to your computer and use it in GitHub Desktop.
gulp 4, gulpfile (pug, sass, autoprefixer, browser-sync)
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
/*! | |
* eutheme.com | |
* 29.01.2019 | |
*/ | |
const {src,dest,parallel,watch} = require('gulp'); | |
const pug = require('gulp-pug'); | |
const sass = require('gulp-sass'); | |
const prefix = require('gulp-autoprefixer'); | |
const server = require('browser-sync').create(); | |
function html() { | |
return src('sources/pug/*.pug') | |
.pipe(pug({ | |
pretty: true | |
})) | |
.pipe(dest('public')) | |
} | |
function css() { | |
return src('sources/scss/*.scss') | |
.pipe(sass({ | |
outputStyle: 'expanded' | |
})) | |
.pipe(prefix({ | |
browsers: ['last 2 versions'], | |
cascade: false | |
})) | |
.pipe(dest('public/css')) | |
} | |
function yenile(done) { | |
server.reload() | |
done() | |
} | |
function izle() { | |
watch('sources/pug/**/*.pug',parallel(html,yenile)); | |
watch('sources/scss/**/*.scss',parallel(css,yenile)); | |
} | |
function serve() { | |
server.init({ | |
server: { | |
baseDir: 'public' | |
} | |
}) | |
} | |
exports.default = parallel(serve,izle); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment