Skip to content

Instantly share code, notes, and snippets.

@stouset
Created June 13, 2011 15:42
Show Gist options
  • Save stouset/1023013 to your computer and use it in GitHub Desktop.
Save stouset/1023013 to your computer and use it in GitHub Desktop.
Patch to auto-reload generated CSS/JS
def reload_browser(paths = [])
UI.info "Reloading browser: #{paths.join(' ')}"
paths.each do |path|
path = path.gsub %r{ (\.[^.]+) .* }x, '\1'
data = ['refresh', {
:path => "#{Dir.pwd}/#{path}",
:apply_js_live => @options[:apply_js_live],
:apply_css_live => @options[:apply_css_live]
}].to_json
UI.debug data
@web_sockets.each { |ws| ws.send(data) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment