Skip to content

Instantly share code, notes, and snippets.

@julik
Created March 22, 2014 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julik/9711389 to your computer and use it in GitHub Desktop.
Save julik/9711389 to your computer and use it in GitHub Desktop.
# Rig up livereload for frontend stuff
guard 'livereload', apply_js_live: false, apply_css_live: true do
# Do full reloads for everything except CSS
watch(%r{.+\.(js|coffee|erb)$})
# Do full reloads when we modify the bom.json file with
# our Javascripts listed in loading order
watch(%r{.+\/bom\.json$})
# Using live compilation has it's downsides.
#
# LiveReload in rack-livereload will only do CSS injection
# if the "path" parameter passed to it has the ".css" raw extension.
# Therefore we have to hint LiveReload that once a .scss is modified
# he has to notify of changes on the related ".css" file.
watch(%r{.+\.(s?css)$}) do | m |
m[0].gsub(/\.scss$/, '.css') # Make the browser reload with the CSS URL instead
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment