guard init livereload
でこんなGuardfileが出てきたんですがwatch関数がどこで定義されているのかわかりません。
調べる方法を教えてください。
ruby
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 18guard '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 watch(%r{public/.+.(#{compiled_exts * '|'})}) 38 39 extensions.each do |ext, type| 40 watch(%r{ 41 (?:app|vendor) 42 (?:/assets/\w+/(?<path>[^.]+) # path+base without extension 43 (?<ext>.#{ext})) # matching extension (must be first encountered) 44 (?:.\w+|$) # other extensions 45 }x) do |m| 46 path = m[1] 47 "/assets/#{path}.#{type}" 48 end 49 end 50 51 # file needing a full reload of the page anyway 52 watch(%r{app/views/.+.(#{rails_view_exts * '|'})$}) 53 watch(%r{app/helpers/.+.rb}) 54 watch(%r{config/locales/.+.yml}) 55end
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。