Skip to content

Instantly share code, notes, and snippets.

@Damon4
Created September 10, 2014 15:11
Show Gist options
  • Select an option

  • Save Damon4/bbbfc8b5f855b0d9d6f5 to your computer and use it in GitHub Desktop.

Select an option

Save Damon4/bbbfc8b5f855b0d9d6f5 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var urlAdjuster = require('gulp-css-url-adjuster');
var nib = require('nib');
var stylus = require('gulp-stylus');
var sourcemaps = require('gulp-sourcemaps');
var timestamp = Date.now();
// Get and render all .styl files recursively
gulp.task('stylus', function () {
gulp.src('./app/frontend/www/res/css/**/*.styl')
.pipe(stylus({
use: [nib()],
url: {
name: 'embedurl'
},
sourcemap: true,
'sourcemap-root': '/res/css/'
}))
.pipe(gulp.dest('./app/frontend/www/res/css/'));
});
gulp.task('css-url', function() {
return gulp.src(['./app/frontend/www/res/css/**/*.css'])
.pipe(urlAdjuster({
append: function(s) { return s + '?'+timestamp; }
}))
.pipe(gulp.dest('./app/frontend/www/res/css/'));
});
gulp.task('watch', function() {
gulp.run('stylus');
gulp.watch('./app/frontend/www/res/css/**/*.styl', function() {
gulp.run('stylus');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment