Skip to content

Instantly share code, notes, and snippets.

@erkanunluturk
Created January 30, 2019 19:02
Show Gist options
  • Save erkanunluturk/2198826fd2e2f126e4e48f23c1d353e2 to your computer and use it in GitHub Desktop.
Save erkanunluturk/2198826fd2e2f126e4e48f23c1d353e2 to your computer and use it in GitHub Desktop.
gulp 4, gulpfile (pug, sass, autoprefixer, browser-sync)
/*!
* 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