Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRakefile
More file actions
Latest commit
43 lines (29 loc) · 884 Bytes
/
Copy pathRakefile
File metadata and controls
43 lines (29 loc) · 884 Bytes
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
# frozen_string_literal: true
require'rubygems'
require'bundler'
Bundler.require(:default)
BUILD_FILES=%w[hyper-routerhyperstack-compilerhyperstackopal].freeze
defcompile_js(filename)
puts"Compiling #{filename}.js..."
File.binwrite("./dist/#{filename}.js",Opal::Builder.build(filename).to_s)
puts'...done!'
end
defminify_js(filename)
puts"Minifying #{filename}.js..."
js_file="./dist/#{filename}.js"
js_min_file="./dist/#{filename}.min.js"
File.open(js_min_file,'w').write(Uglifier.new(harmony: true).compile(File.read(js_file)))
puts'...done!'
end
desc'Compile and minify hyperstack libs'
task:compiledo
Opal.append_path'lib'
# Cleanup previous builds
FileUtils.rm_rf('dist')
FileUtils.mkdir('dist')
BUILD_FILES.eachdo |filename|
compile_js(filename)
minify_js(filename)
end
end
taskdefault: %i[compile]