-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
68 lines (53 loc) · 1.53 KB
/
Rakefile
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
63
64
65
66
67
68
#Author: Donald L. Merand
local_site_dir = "."
assets_dir = "#{local_site_dir}/assets"
css_dir = "#{assets_dir}/css"
tailwind_compile = "npx tailwindcss -i #{css_dir}/style.css -o #{css_dir}/site.css"
task :default => "watch:all"
namespace :sync do
desc "send to donald.merand.org"
task :push => [:'compile:all'] do
system 'rsync -avzI _site/ donaldmerand:public_html/donald.merand.org/'
end
end
namespace :compile do
jekyll_compile = "bundle exec jekyll build"
desc "Compile Jekyll"
task :jekyll do
sh jekyll_compile
end
desc "Compile Tailwind"
task :tailwind do
sh tailwind_compile
end
desc 'Compile all assets'
task :all => [:jekyll, :tailwind] do
puts "All assets compiled!"
end
end
namespace :watch do
jekyll_watch = "bundle exec jekyll serve"
tailwind_watch = "#{tailwind_compile} --watch"
desc "Watch Jekyll action"
task :jekyll do
puts "jekyll watching"
system jekyll_watch
end
desc "Watch Tailwind"
task "tailwind" do
puts "tailwind watching"
system tailwind_watch
end
#copied/hacked this code from https://github.com/imathis/octopress/blob/master/Rakefile
desc "Watch all assets for changes"
task :all do
puts "monitoring assets for changes and auto-compiling..."
jekyll_pid = Process.spawn(jekyll_watch)
tailwind_pid = Process.spawn(tailwind_watch)
trap("INT") {
[jekyll_pid, tailwind_pid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }
exit 0
}
[jekyll_pid, tailwind_pid].each { |pid| Process.wait(pid) }
end
end