Last active
December 30, 2015 02:28
-
-
Save thmsbkkr/f59b463097118ff8380e to your computer and use it in GitHub Desktop.
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
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