Skip to content

Commit

Permalink
Merge branch 'requirejs-enhancements' of https://github.com/MartinSny…
Browse files Browse the repository at this point in the history
…der/gradle-js-plugin into requirejs-enhancements
  • Loading branch information
boardbloke committed Aug 22, 2013
2 parents edaab6a + d6fbfc4 commit 4808f6a
Show file tree
Hide file tree
Showing 6 changed files with 47,254 additions and 21,459 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ JSDoc 3 options:
- *(Must declare this or `requirejs.options`)* requirejs.buildprofile = File reference for config [example](https://github.com/eriwen/gradle-js-plugin/blob/master/src/test/resources/requirejs/build.js)
- requirejs.options = Map of options [require.js docs](http://requirejs.org/docs/optimization.html#options)
- *(Optional)* ignoreExitCode = Fail build if `false` and require.js did not run successfully. Default is `false`.
- *(Optional)* requirejs.impl = r.js implementation file. Version 2.1.8 is provided within this plugin. Specifying this option allows users to specify a version of the require optimizer of their own choosing

What, you want more? [Tell me!](https://github.com/eriwen/gradle-js-plugin/issues)

Expand All @@ -184,6 +185,7 @@ This project is made possible due to the efforts of these fine people:
* Martin Ziel - Allowing minifyJs task to accept multiple files as input
* [Joe Fitzgerald](https://github.com/joefitzgerald) - JSHint and RequireJS features
* [levsa](https://github.com/levsa) - JSHint predef and checkstyle reporter
* [Martin Snyder](https://github.com/MartinSnyder) - requireJs impl option

## See Also
The [Gradle CSS Plugin](https://github.com/eriwen/gradle-css-plugin)!
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class RequireJsExtension {
public static final String NAME = 'requirejs'

@Input File buildprofile = null
@Input File impl = null

@Input LinkedHashMap<String, Object> options = []
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ class RequireJsTask extends SourceTask {

@TaskAction
def run() {
final File requireJsFile = RESOURCE_UTIL.extractFileToDirectory(new File(project.buildDir, TMP_DIR), REQUIREJS_PATH)
LinkedHashMap<String, Object> options = [] // [optimize: "none", logLevel: 2, skipModuleInsertion: false, out: dest]
options.putAll(project.requirejs.options)

final File requireJsFile
if (project.requirejs.impl != null && project.requirejs.impl.class == File) {
requireJsFile = new File("${project.requirejs.impl.canonicalPath}")
} else {
requireJsFile = RESOURCE_UTIL.extractFileToDirectory(new File(project.buildDir, TMP_DIR), REQUIREJS_PATH)
}

final List<String> args = [requireJsFile.canonicalPath]
args.add("-o")
if (project.requirejs.buildprofile != null && project.requirejs.buildprofile.class == File && project.requirejs.buildprofile.exists()) {
Expand Down
Loading

0 comments on commit 4808f6a

Please sign in to comment.