在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):eriwen/gradle-js-plugin开源软件地址(OpenSource Url):https://github.com/eriwen/gradle-js-plugin开源编程语言(OpenSource Language):JavaScript 97.3%开源软件介绍(OpenSource Introduction):Gradle Javascript Plugin!Aiming to be the simplest way to manage your JavaScript in a build. Quick StartWrangling your JS in a Gradle build is easy! Just add this to your build.gradle file: Gradle 2.1+plugins {
id "com.eriwen.gradle.js" version "2.14.1"
} Gradle 2.0-buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.eriwen:gradle-js-plugin:1.12.1"
}
}
apply plugin: "com.eriwen.gradle.js" // Declare your sources
javascript.source {
dev {
js {
srcDir jsSrcDir
include "*.js"
exclude "*.min.js"
}
}
prod {
js {
srcDir jsSrcDir
include "*.min.js"
}
}
} options)Combining Files (// Configure the built-in task
combineJs {
encoding = "UTF-8"
source = javascript.source.dev.js.files
dest = file("${buildDir}/all.js")
}
// Create new CombineJsTasks if you have multiple sets of JS files
task jsDev(type: com.eriwen.gradle.js.tasks.CombineJsTask) {
source = ["${projectDir}/js/file1.js", "${projectDir}/js/file2.js"]
dest = file("${buildDir}/all-debug.js")
}
task jsProd(type: com.eriwen.gradle.js.tasks.CombineJsTask) {
source = ["${projectDir}/js/file1.js", "${projectDir}/js/file2.js"]
dest = file("${buildDir}/all.js")
} Google Closure Compiler (options)Minifying files withminifyJs {
source = combineJs
dest = file("${buildDir}/all-min.js")
sourceMap = file("${buildDir}/all.sourcemap.json")
closure {
warningLevel = 'QUIET'
}
} options)GZip JS (gzipJs {
source = minifyjs
dest = file("${buildDir}/all-min.js")
} JSHint support (options)jshint {
source = javascript.source.dev.js.files
dest = file("${buildDir}/jshint.out")
reporter = 'checkstyle'
jshint.options = [expr: "true", unused: "true"]
} JSDoc 3 support (options)jsdoc {
source = ["${projectDir}/js/file1.js", "${projectDir}/js/file2.js"]
destinationDir = file("${buildDir}/jsdoc")
} props2js support (options)props2js {
source = file("${projectDir}/src/test/resources/test.properties")
dest = file("${buildDir}/props.jsonp")
props {
type = 'jsonp'
functionName = 'fn'
}
} require.js via r.js (options)requireJs {
source = javascript.source.dev.js.files
dest = file("${buildDir}/out.js")
requirejs.buildprofile = new File("src/main/resources/requirejs-config.js")
} Built-in Tasks and OptionscombineJs
Google Closure Compiler)minifyJs (Uses the
gzipJs
jshint
jsdoc
props2js
requireJs
What, you want more? Tell me! ContributorsThis project is made possible due to the efforts of these fine people:
See AlsoThe Gradle CSS Plugin! |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论