-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGuardfile
62 lines (50 loc) · 2.02 KB
/
Guardfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
guard :concat, :type => "css", :files => %w[bootstrap responsive flexslider theme-style color-blue custom-style], :input_dir => "public/css", :output => "public/css/styles.min"
guard :concat, :type => "js", :files => %w[jquery bootstrap-transition bootstrap-alert bootstrap-affix bootstrap-modal bootstrap-dropdown bootstrap-scrollspy bootstrap-tab bootstrap-tooltip bootstrap-popover bootstrap-button bootstrap-collapse bootstrap-carousel bootstrap-typeahead jquery.quicksand jquery.flexslider-min script], :input_dir => "public/js", :output => "public/js/scripts.min"
# Refresh the browser on save
guard 'livereload' do
watch(%r{.+(?<!\.min)\.(css|html|js|blade\.php)$})
end
guard :phpunit, :all_on_start => false, :tests_path => 'app/tests/', :cli => '--colors -c phpunit.xml' do
# Run any test in app/tests upon save.
watch(%r{^.+Test\.php$})
# When a view file is updated, run tests.
# Tip: you probably only want to run your integration tests.
watch(%r{app/views/.+\.php}) { Dir.glob('app/tests/**/*.php') }
# When a file is edited, try to run its associated test.
# Save app/models/User.php, and it will run app/tests/models/UserTest.php
watch(%r{^app/(.+)/(.+)\.php$}) { |m| "app/tests/#{m[1]}/#{m[2]}Test.php"}
end
module ::Guard
class Refresher < Guard
def run_all
# refresh
end
def run_on_additions(paths)
refresh
end
def run_on_removals(paths)
refresh
end
def refresh
`php artisan guard:refresh`
end
end
end
require 'cssmin'
require 'jsmin'
guard :refresher do
watch(%r[public/js/.+])
watch(%r[public/css/.+])
watch(%r{app/config/packages/way/guard-laravel/guard.php}) do |m|
`php artisan guard:refresh`
end
watch('public/css/styles.min.css') do |m|
css = File.read(m[0])
File.open(m[0], 'w') { |file| file.write(CSSMin.minify(css)) }
end
watch('public/js/scripts.min.js') do |m|
js = File.read(m[0])
File.open(m[0], 'w') { |file| file.write(JSMin.minify(js)) }
end
end
guard :sass, :input => 'app/assets/sass', :output => 'public/css'