Skip to content

Instantly share code, notes, and snippets.

Created June 6, 2016 21:01
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 anonymous/899ae8f2a5e184cf5777c1dda33af253 to your computer and use it in GitHub Desktop.
Save anonymous/899ae8f2a5e184cf5777c1dda33af253 to your computer and use it in GitHub Desktop.
extensions.each do |ext, type|
watch(%r{
(?:app|vendor)
(?:/assets/\w+/(?<path>[^.]+) # path+base without extension
(?<ext>\.#{ext})) # matching extension (must be first encountered)
(?:\.\w+|$) # other extensions
}x) do |m|
path = m[1]
"/assets/#{path}.#{type}"
end
end
extensions.each do |ext, type|
watch(
%r{
(?:app|vendor)
# Path and base without extension
(?:/assets/\w+/(?<path>[^.]+)
# Matching extension, on first encounter
(?<ext>\.#{ext}))
# Other extensions
(?:\.\w+|$)
}x) do |m|
path = m[1]
"/assets/#{path}.#{type}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment