-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
32 lines (27 loc) · 953 Bytes
/
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
require 'bundler'
Bundler.require
desc 'Build the script to mescalina.js and render the view'
task :build do
env = Opal::Environment.new
env.append_path 'app'
env.append_path 'js'
env.append_path 'fonts'
env.append_path 'css'
File.open('mescalina.js', 'w+') do |out|
out << env['application'].to_s
end
File.open('index.html', 'w+') do |out|
f = File.read('index.it.html.haml').gsub('= javascript_include_tag "application"', '%script(src="mescalina.js")')
out << Haml::Engine.new(f).render
end
File.open('en.html', 'w+') do |out|
f = File.read('index.html.haml').gsub('= javascript_include_tag "application"', '%script(src="mescalina.js")')
out << Haml::Engine.new(f).render
end
end
desc 'Clean the compiled files'
task :clean do
File.delete 'mescalina.js' if File.exists? 'mescalina.js'
File.delete 'index.html' if File.exists? 'index.html'
File.delete 'en.html' if File.exists? 'en.html'
end