Created
March 4, 2016 11:54
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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