Skip to content

Instantly share code, notes, and snippets.

@bsodmike
Created April 21, 2016 21:18
Show Gist options
  • Save bsodmike/f0dcc76ae179121c1b471e594bd75c77 to your computer and use it in GitHub Desktop.
Save bsodmike/f0dcc76ae179121c1b471e594bd75c77 to your computer and use it in GitHub Desktop.
Rails, Gulp, and Browsersync together at last
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var setupWatchers = function() {
gulp.watch(['./app/views/**/*.erb',
'./app/assets/javascripts/**/*.js'], ['reload']);
gulp.watch(['./app/assets/stylesheets/**/*.scss'], ['reloadCSS'])
};
gulp.task('reload', function(){
return browserSync.reload();
});
gulp.task('reloadCSS', function() {
return browserSync.reload('*.css');
});
gulp.task('init', function() {
browserSync.init({
proxy: '0.0.0.0:3000',
port: 8000,
open: false,
ui: {
port: 8001
}
});
setupWatchers();
});
gulp.task('default', ['init']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment