-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathminify.rb
executable file
·29 lines (21 loc) · 1001 Bytes
/
minify.rb
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
#!/usr/bin/env ruby
puts "Minifying FlowCommonWeb files."
flowCommonWebDir = "#{__dir__}/Sources/FlowCommonWebFiles"
waapi = "web-animations.min.js"
flowCommonWebFiles = [
"Player.js",
"ToggleButton.js",
"HoverElement.js"
]
outputDir = "#{__dir__}/generated"
system "mkdir #{outputDir}"
flowcommon = "flowcommon.js"
flowcommonMin = "flowcommon.min.js"
flowcommonWaapiMin = "flowcommon-waapi.min.js"
puts "Creating flowcommon.js"
abort unless system "cd #{flowCommonWebDir} && uglifyjs #{flowCommonWebFiles.join(' ')} --beautify --output #{outputDir}/#{flowcommon}"
puts "Creating flowcommon.min.js"
abort unless system "cd #{flowCommonWebDir} && uglifyjs #{flowCommonWebFiles.join(' ')} --compress --output #{outputDir}/#{flowcommonMin}"
puts "Creating flowcommon-waapi.min.js"
abort unless system "cd #{flowCommonWebDir} && uglifyjs #{flowCommonWebFiles.join(' ')} #{waapi} --compress --output #{outputDir}/#{flowcommonWaapiMin}"
puts "Successfully Minified FlowCommonWeb files!"