forked from MiniCodeMonkey/Sophie-Tracker-3000
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guardfile
46 lines (38 loc) · 1.31 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
guard :concat, :type => "css", :files => %w[dashboard flip icons modal notification sleep slider stats style utilities], :input_dir => "public/css", :output => "public/css/styles.min"
guard :concat, :type => "js", :files => %w[activity bath Chart diaper feed flip food jQuery.fastClick lastevent medicine milestone mobile note notification pump sleep spinner stats supplies track], :input_dir => "public/js", :output => "public/js/scripts.min"
guard :less, :all_on_start => true, :all_on_start => false, :output => 'public/css' do
watch(%r[^app/assets/less/(.+\.less)$])
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