Skip to content

Instantly share code, notes, and snippets.

@aTei
Created March 4, 2016 11:54
Show Gist options
  • Select an option

  • Save aTei/ae8bd14d70802babfc57 to your computer and use it in GitHub Desktop.

Select an option

Save aTei/ae8bd14d70802babfc57 to your computer and use it in GitHub Desktop.
Ruby on Rails LiveReload only CSS (not a whole page) on SCSS change
// Ruby on Rails LiveReload only CSS (not a whole page) on SCSS change
// 1. Install LiveReload Chrome extention https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei?hl=en
// 2. Run `rails server` and `gulp watch`
// 3. Click `Enable Livereload` button in Chrome
// 4. Edit you SCSS
// 5. Success!
var gulp = require('gulp');
var livereload = require('gulp-livereload');
gulp.task('watch', function() {
livereload.listen();
gulp.watch('front/app/assets/stylesheets/**').on('change', function(file){
livereload.reload('http://lvh.me:3000/assets/front/application.css');
// in case if you support RTL version
livereload.reload('http://lvh.me:3000/assets/front/application-rtl.css');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment