ClojureScriptExtension

Entry point to the DSL for configuring ClojureScript builds.

Properties

Property Type Description

rootOutputDir

DirectoryProperty

Root directory builds output dirs will conventionally be children of

builds

NamedDomainObjectContainer<ClojureScriptBuild>

Container of all builds for this project

Methods

Method Description

void builds(Action<? super NamedDomainObjectContainer<ClojureScriptBuild>> action)

Allows configuring the builds in a block

Example

If JVM options must be set, configure the respective task’s forkOptions.
build.gradle
clojurescript {
  builds {
    // Defaults noted here are for custom builds, the convention plugin configures the builds it adds differently
    mybuild {
      sourceRoots.from('src/somewhere') // no default

      // Configuration of the compile<Build>ClojureScript task (defaults match what is defaulted in the ClojureScript compile options)
      compiler {
        outputTo = 'public/some/file/path.js' // path is relative to the task's destinationDir
        outputDir = 'public/some/path' // path is relative to the task's destinationDir
        optimizations = 'advanced'
        main = 'foo.bar'
        assetPath = 'public/some/path'
        sourceMap = 'public/some/file/path.js.map' // path is relative to the task's destinationDir
        verbose = true
        prettyPrint = false
        target = 'nodejs'

        // foreignLibs
        externs = ['jquery-externs.js']

        // modules

        // stableNames
        preloads = ['foo.dev']
        npmDeps = ['lodash': '4.17.4']
        installDeps = true
        checkedArrays = 'warn'
      }
    }
  }
}
build.gradle.kts
clojurescript {
  builds {
    // Defaults noted here are for custom builds, the convention plugin configures the builds it adds differently
    mybuild {
      sourceRoots.from("src/somewhere") // no default

      // Configuration of the compile<Build>ClojureScript task (defaults match what is defaulted in the ClojureScript compile options)
      compiler {
        outputTo = "public/some/file/path.js" // path is relative to the task's destinationDir
        outputDir = "public/some/path" // path is relative to the task's destinationDir
        optimizations = "advanced"
        main = "foo.bar"
        assetPath = "public/some/path"
        sourceMap = "public/some/file/path.js.map" // path is relative to the task's destinationDir
        verbose = true
        prettyPrint = false
        target = "nodejs"

        // foreignLibs
        externs = listOf("jquery-externs.js")

        // modules

        // stableNames
        preloads = listOf("foo.dev")
        npmDeps = mapOf("lodash" to "4.17.4")
        installDeps = true
        checkedArrays = "warn"
      }
    }
  }
}