Skip to content

Instantly share code, notes, and snippets.

@thmsbkkr
Last active December 30, 2015 02:28
Show Gist options
  • Save thmsbkkr/f59b463097118ff8380e to your computer and use it in GitHub Desktop.
Save thmsbkkr/f59b463097118ff8380e to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
// Automatic browser refreshing with browser-sync
var browserSync = require('browser-sync').create();
// Stylus
var stylus = require('gulp-stylus');
var postStylus = require('poststylus');
// Plugins for stylus
var autoprefixer = require('autoprefixer');
var lost = require('lost');
var rupture = require('rupture');
// Compile stylus files
gulp.task('stylus', function () {
gulp.src('app/stylus/app.styl')
.pipe(sourcemaps.init())
.pipe(stylus({
use: [
postStylus([
autoprefixer({ browsers: ['last 2 versions'] }),
lost
]),
rupture()
]
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('app/css'))
.pipe(browserSync.stream());
});
// Static Server + watching stylus/html files
gulp.task('serve', ['stylus'], function() {
browserSync.init({
server: "./app"
});
gulp.watch("app/stylus/*/**.styl", ['stylus']);
gulp.watch("app/*.html").on('change', browserSync.reload);
});
gulp.task('default', ['serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment