Skip to content

Instantly share code, notes, and snippets.

@nishim
Created June 10, 2018 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nishim/08d74ec7b5306badd63b6fe666e50222 to your computer and use it in GitHub Desktop.
Save nishim/08d74ec7b5306badd63b6fe666e50222 to your computer and use it in GitHub Desktop.
gulp/ejs/scss
'use strict';
const gulp = require('gulp')
const sass = require('gulp-sass')
const autoprefixer = require('gulp-autoprefixer')
const ejs = require('gulp-ejs')
const rename = require('gulp-rename')
const paths = {
styles: {
src: 'src/scss/**/*.scss',
dest: 'public/styles/'
},
templates: {
src: 'src/ejs/**/*.ejs',
dest: 'public/'
}
}
const styles = () => {
return gulp.src(paths.styles.src)
.pipe(sass({outputStyle: 'compressed'}))
.pipe(autoprefixer())
.pipe(gulp.dest(paths.styles.dest))
}
const templates = () => {
return gulp.src(paths.templates.src)
.pipe(ejs())
.pipe(rename({extname: '.html'}))
.pipe(gulp.dest(paths.templates.dest))
}
const watch = () => {
gulp.watch(paths.styles.src, styles)
gulp.watch(paths.templates.src, templates)
}
exports.styles = styles
exports.templates = templates
exports.watch = watch
{
"devDependencies": {
"gulp": "^4.0.0",
"gulp-autoprefixer": "^5.0.0",
"gulp-ejs": "^3.1.3",
"gulp-rename": "^1.2.3",
"gulp-sass": "^4.0.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment