Skip to content

Commit bbdc4e3

Browse files
authored
generated 3 different version for FlowCommon Web for the CDN (#9)
1 parent cac5a42 commit bbdc4e3

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
package-lock.json
33
flowCommon.min.js
44
flowCommonWeb.min.js
5+
generated/

minify.rb

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
#!/usr/bin/env ruby
22

33
puts "Minifying FlowCommonWeb files."
4+
45
flowCommonWebDir = "#{__dir__}/Sources/FlowCommonWebFiles"
5-
flowCommonWebFiles = "Track.js Animation.js player.js web-animations.min.js ToggleButton.js"
6-
outputDir = "#{__dir__}"
7-
filename = "flowcommon.min.js"
6+
waapi = "web-animations.min.js"
7+
flowCommonWebFiles = [
8+
"Track.js",
9+
"Animation.js",
10+
"player.js",
11+
"ToggleButton.js"
12+
]
13+
14+
outputDir = "#{__dir__}/generated"
15+
system "mkdir #{outputDir}"
16+
17+
flowcommon = "flowcommon.js"
18+
flowcommonMin = "flowcommon.min.js"
19+
flowcommonWaapiMin = "flowcommon-waapi.min.js"
20+
21+
puts "Creating flowcommon.js"
22+
abort unless system "cd #{flowCommonWebDir} && uglifyjs #{flowCommonWebFiles.join(' ')} --beautify --output #{outputDir}/#{flowcommon}"
23+
24+
puts "Creating flowcommon.min.js"
25+
abort unless system "cd #{flowCommonWebDir} && uglifyjs #{flowCommonWebFiles.join(' ')} --compress --output #{outputDir}/#{flowcommonMin}"
826

9-
abort unless system "cd #{flowCommonWebDir} && uglifyjs #{flowCommonWebFiles} --compress --output #{outputDir}/#{filename}"
27+
puts "Creating flowcommon-waapi.min.js"
28+
abort unless system "cd #{flowCommonWebDir} && uglifyjs #{flowCommonWebFiles.join(' ')} #{waapi} --compress --output #{outputDir}/#{flowcommonWaapiMin}"
1029

1130
puts "Successfully Minified FlowCommonWeb files!"

0 commit comments

Comments
 (0)