SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # A sample Guardfile
  2. # More info at https://github.com/guard/guard#readme
  3.  
  4. ## Uncomment and set this to only include directories you want to watch
  5. # directories %w(app lib config test spec features) \
  6. #  .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
  7.  
  8. ## Note: if you are using the `directories` clause above and you are not
  9. ## watching the project directory ('.'), then you will want to move
  10. ## the Guardfile to a watched dir and symlink it back, e.g.
  11. #
  12. #  $ mkdir config
  13. #  $ mv Guardfile config/
  14. #  $ ln -s config/Guardfile .
  15. #
  16. # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
  17.  
  18. guard 'livereload' do
  19.   extensions = {
  20.     css: :css,
  21.     scss: :css,
  22.     sass: :css,
  23.     js: :js,
  24.     coffee: :js,
  25.     html: :html,
  26.     png: :png,
  27.     gif: :gif,
  28.     jpg: :jpg,
  29.     jpeg: :jpeg,
  30.     # less: :less, # uncomment if you want LESS stylesheets done in browser
  31.   }
  32.  
  33.   rails_view_exts = %w(erb haml slim)
  34.  
  35.   # file types LiveReload may optimize refresh for
  36.   compiled_exts = extensions.values.uniq
  37.    
  38.   watch(%r{.+\.(#{compiled_exts * '|'})})
  39.  
  40.   extensions.each do |ext, type|
  41.     watch(%r{
  42.           (?:app|vendor)
  43.           (?:/assets/\w+/(?<path>[^.]+) # path+base without extension
  44.            (?<ext>\.#{ext})) # matching extension (must be first encountered)
  45.           (?:\.\w+|$) # other extensions
  46.           }x) do |m|
  47.       path = m[1]
  48.       "/assets/#{path}.#{type}"
  49.     end
  50.   end
  51.  
  52.   # file needing a full reload of the page anyway
  53.   watch(%r{app/views/.+\.(#{rails_view_exts * '|'})$})
  54.   watch(%r{app/helpers/.+\.rb})
  55.   watch(%r{config/locales/.+\.yml})
  56. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top