-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
79 lines (69 loc) · 1.94 KB
/
build.gradle
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
69
70
71
72
73
74
75
76
77
78
79
plugins {
id "com.eriwen.gradle.js" version "2.14.1"
}
group = 'oliv.web.components'
version = '1.0'
javascript.source {
dev {
js {
srcDir "oliv-components/widgets"
include "*.js"
exclude "*.min.js"
exclude "*.map"
}
}
prod {
js {
srcDir "oliv-components/widgets"
include "*.min.js"
}
}
}
repositories {
mavenCentral()
mavenLocal()
}
minifyJs {
source = "oliv-components/widgets"
//dest = file("oliv-components/minified")
dest = file("oliv-components/minified/all-min.js")
sourceMap = file("oliv-components/minified/all.sourcemap.json")
closure {
warningLevel = 'QUIET'
compilerOptions.languageIn = "ECMASCRIPT6"
compilerOptions.languageOut = "ECMASCRIPT5_STRICT"
}
}
//import com.eriwen.gradle.js.tasks.MinifyJsTask
task minifyJS
minifyJS.doLast {
fileTree(dir: 'oliv-components/widgets', include: ['*.js'], exclude: ['WorldMap.js', 'minjs/*']).eachWithIndex { file, index ->
println ">>> Processing " + file.absoluteFile
def dynamicTask = "minify$index"
task "${dynamicTask}" (type: MinifyJsTask) {
source = file.absolutePath;
// dest = "${buildDir}/min.${file.name}"
dest = "oliv-components/minified/${file.name}"
closure.compilationLevel='SIMPLE_OPTIMIZATIONS'
closure {
warningLevel = "QUIET"
compilerOptions.languageIn = "ECMASCRIPT6"
compilerOptions.languageOut = "ECMASCRIPT5_STRICT"
}
}
tasks."$dynamicTask".execute()
}
}
//jsdoc {
// source = "oliv-components/widgets/*.js"
// destinationDir = file("./jsdoc")
//}
task jsDoc(type: com.eriwen.gradle.js.tasks.JsDocTask){
source = "oliv-components/widgets"
destinationDir = file("${buildDir}/jsdoc")
closure {
warningLevel = 'QUIET'
compilerOptions.languageIn = "ECMASCRIPT6"
compilerOptions.languageOut = "ECMASCRIPT5"
}
}