Skip to content

Instantly share code, notes, and snippets.

@edemaine
Last active June 17, 2019 15:51
Show Gist options
  • Save edemaine/28c2bfebe326de4853f039e0306c4afa to your computer and use it in GitHub Desktop.
Save edemaine/28c2bfebe326de4853f039e0306c4afa to your computer and use it in GitHub Desktop.
gulpfile.coffee for coffee/pug/stylus website automatic compilation (including watch rule)
# REPLACED BY GITHUB TEMPLATE: https://github.com/edemaine/webapp-coffee-pug-stylus
# Source: https://gist.github.com/edemaine/28c2bfebe326de4853f039e0306c4afa
# To use this gulpfile:
# npm install --save-dev gulp gulp-chmod gulp-coffee gulp-pug gulp-stylus (initialization)
# npx gulp (compile everything once)
# npx gulp watch (automatically compile everything as it changes)
gulp = require 'gulp'
gulpCoffee = require 'gulp-coffee'
gulpChmod = require 'gulp-chmod'
gulpPug = require 'gulp-pug'
gulpStylus = require 'gulp-stylus'
exports.coffee = coffee = ->
gulp.src '*.coffee', ignore: 'gulpfile.coffee'
.pipe gulpCoffee()
.pipe gulpChmod 0o644
.pipe gulp.dest './'
exports.pug = pug = ->
gulp.src '*.pug'
.pipe gulpPug pretty: true
.pipe gulpChmod 0o644
.pipe gulp.dest './'
exports.stylus = stylus = ->
gulp.src '*.styl'
.pipe gulpStylus pretty: true
.pipe gulpChmod 0o644
.pipe gulp.dest './'
exports.watch = watch = ->
gulp.watch '*.coffee', coffee
gulp.watch '*.pug', pug
gulp.watch '*.styl', stylus
exports.default = gulp.series ...[
gulp.parallel coffee, pug, stylus
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment