Skip to content

Instantly share code, notes, and snippets.

@zapatoche
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save zapatoche/9323966 to your computer and use it in GitHub Desktop.

Select an option

Save zapatoche/9323966 to your computer and use it in GitHub Desktop.
Gulp auto compile stylus
{
"name": "stylus-compile",
"version": "0.0.1",
"devDependencies": {
"tiny-lr": "0.0.5",
"gulp": "^3.5.5",
"gulp-util": "^2.2.14",
"gulp-csslint": "0.1.3",
"gulp-livereload": "1.2.0",
"gulp-autoprefixer": "0.0.6",
"gulp-stylus": "0.0.13"
}
}
var lr = require('tiny-lr'),
gulp = require('gulp'),
stylus = require('gulp-stylus'),
livereload = require('gulp-livereload'),
prefix = require('gulp-autoprefixer'),
csslint = require('gulp-csslint'),
server = lr();
gulp.task('stylus', function () {
gulp.src('./*.styl')
.pipe(stylus({set:['compress']}))
.pipe(prefix('last 8 version', '> 1%', 'ie 7', 'ie 8'))
// .pipe(csslint())
// .pipe(csslint.reporter())
.pipe(gulp.dest('./'))
.pipe(livereload(server));
});
gulp.task('watch', function () {
server.listen(35729, function (err) {
if (err) return console.log(err);
gulp.watch('./*.styl', ['stylus']);
});
});
gulp.task('default', ['stylus', 'watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment