Skip to content

Instantly share code, notes, and snippets.

@izelnakri
Created October 27, 2015 14:47
Show Gist options
  • Select an option

  • Save izelnakri/75091d1cf33dbe60d87e to your computer and use it in GitHub Desktop.

Select an option

Save izelnakri/75091d1cf33dbe60d87e to your computer and use it in GitHub Desktop.
var gulp = require('gulp'),
shell = require('gulp-shell'),
runSequence = require('run-sequence'),
stylish = require('jshint-stylish'),
concat = require('gulp-concat'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify');
gulp.task('watch', ['riot'], function () {
return gulp.watch('app/assets/javascripts/components/*.tag', ['riot'])
});
gulp.task('riot:lint', function () {
return gulp.src('app/assets/javascripts/components/*.tag')
.pipe(jshint.extract('auto'))
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('riot:concat', ['riot:lint'], function () {
return gulp.src('app/assets/javascripts/components/*.tag')
.pipe(concat('components.tag'))
.pipe(gulp.dest('tmp/riot'));
});
gulp.task('riot:shell', ['riot:concat'], function () {
return gulp.src('tmp/riot/components.tag')
.pipe(shell('riot tmp/riot/components.tag tmp/riot/components.js --m')); //this is async
});
gulp.task('riot:sync', function (callback) {
runSequence('riot:shell', callback);
});
gulp.task('riot', ['riot:sync'], function () {
return gulp.src('tmp/riot/components.js')
.pipe(uglify())
.pipe(concat('components.js'))
.pipe(gulp.dest('app/assets/javascripts'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment