{"id":13760503,"url":"https://github.com/emezeske/lein-cljsbuild","last_synced_at":"2025-05-14T14:07:32.171Z","repository":{"id":2124301,"uuid":"3067051","full_name":"emezeske/lein-cljsbuild","owner":"emezeske","description":"Leiningen plugin to make ClojureScript development easy.","archived":false,"fork":false,"pushed_at":"2021-03-19T16:43:38.000Z","size":840,"stargazers_count":1100,"open_issues_count":49,"forks_count":151,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-05-09T04:38:54.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emezeske.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-12-29T05:16:58.000Z","updated_at":"2025-04-07T13:26:12.000Z","dependencies_parsed_at":"2022-09-05T22:40:08.587Z","dependency_job_id":null,"html_url":"https://github.com/emezeske/lein-cljsbuild","commit_stats":null,"previous_names":[],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emezeske%2Flein-cljsbuild","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emezeske%2Flein-cljsbuild/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emezeske%2Flein-cljsbuild/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emezeske%2Flein-cljsbuild/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emezeske","download_url":"https://codeload.github.com/emezeske/lein-cljsbuild/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254036813,"owners_count":22003655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T13:01:11.676Z","updated_at":"2025-05-14T14:07:32.155Z","avatar_url":"https://github.com/emezeske.png","language":"Clojure","funding_links":[],"categories":["Clojure","Awesome ClojureScript","\u003ca name=\"Clojure\"\u003e\u003c/a\u003eClojure"],"sub_categories":["Development"],"readme":"# lein-cljsbuild\n\n#### Latest version:\n[![Clojars Project](https://clojars.org/lein-cljsbuild/latest-version.svg)](http://clojars.org/lein-cljsbuild)\n\nThis is a Leiningen plugin that makes it quick and easy to automatically compile\nyour ClojureScript code into Javascript whenever you modify it. It's simple\nto install and allows you to configure the ClojureScript compiler from within your\n`project.clj` file.\n\nBeyond basic compiler support, lein-cljsbuild can optionally help with a few other things:\n\n* [Launching REPLs for interactive development](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/doc/REPL.md)\n* [Launching ClojureScript tests](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/doc/TESTING.md)\n\nThe latest version of lein-cljsbuild is `1.1.8`.\n[See the release notes here.](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/doc/RELEASE-NOTES.md)\n\n*Note that cljsbuild crossovers are deprecated, and will be removed eventually.\nYou should never use them. Please use either [reader conditionals](http://dev.clojure.org/display/design/Reader+Conditionals)\n(available in Clojure \u0026gt;= 1.7.0-beta2 and ClojureScript \u0026gt;= 0.0-3255), or [cljx](http://github.com/lynaghk/cljx)\nto target both Clojure and ClojureScript from the same codebase.*\n\n**If you are using ClojureScript \u003e= 1.7.170 you need to use a lein-cljsbuild version \u003e= 1.1.1.**\n\n## Requirements\n\nThe lein-cljsbuild plugin works with\n[Leiningen](https://github.com/technomancy/leiningen/blob/master/README.md)\nversion `2.1.2` or higher.\n\n## Installation\n\nYou can install the plugin by adding lein-cljsbuild to your `project.clj`\nfile in the `:plugins` section:\n\n```clj\n(defproject lein-cljsbuild-example \"1.2.3\"\n  :plugins [[lein-cljsbuild \"1.1.8\"]])\n```\n\nIn addition, _you should add an explicit ClojureScript dependency to your\nproject using the ClojureScript version you want to use_:\n\n```clojure\n:dependencies [[org.clojure/clojurescript \"1.9.521\"]]\n```\n\nlein-cljsbuild will add a dependency to your project if it doesn't already\ncontain one, but that functionality will not remain for long. The latest\nversion of lein-cljsbuild currently requires a minimum of ClojureScript\n`0.0-3211`.\n\n## Just Give Me a Damned Example Already!\n\nSee the\n[example-projects](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/example-projects)\ndirectory for a couple of simple examples of how to use lein-cljsbuild. The\n[simple project](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/example-projects/simple)\nshows a dead-simple \"compile only\" configuration, which is a good place to start. The\n[advanced project](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/example-projects/advanced)\ncontains examples of how to use the extended features of the plugin.\n\nFor an exhaustive list of all options supported by lein-cljsbuild, see the\n[sample.project.clj](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/sample.project.clj)\nfile. For a list of options that can be passed to the ClojureScript compiler have a look at the\n[ClojureScript Compiler Options site](https://clojurescript.org/reference/compiler-options).\n\n## Basic Configuration\n\nThe lein-cljsbuild configuration is specified under the `:cljsbuild` section\nof your `project.clj` file. A simple project might look like this:\n\n```clj\n(defproject lein-cljsbuild-example \"1.2.3\"\n  :plugins [[lein-cljsbuild \"1.1.8\"]]\n  :cljsbuild {\n    :builds [{\n        ; The path to the top-level ClojureScript source directory:\n        :source-paths [\"src-cljs\"]\n        ; The standard ClojureScript compiler options:\n        ; (See the ClojureScript compiler documentation for details.)\n        :compiler {\n          :output-to \"war/javascripts/main.js\"  ; default: target/cljsbuild-main.js\n          :optimizations :whitespace\n          :pretty-print true}}]})\n```\n## Basic Usage\n\nOnce the plugin is installed, you can build the ClojureScript once:\n\n    $ lein cljsbuild once\n\nOr you can have lein-cljsbuild watch your source files for changes and\nautomatically rebuild them. This is recommended for development, as it\navoids the time-consuming JVM startup for each build:\n\n    $ lein cljsbuild auto\n\nAssuming you have configured cljsbuild to emit compiler output to one of\nLeiningen's `:clean-targets` (which includes `./target` by default), running\n`lein clean` will delete all of the JavaScript and ClojureScript files that lein-cljsbuild\ngenerates during compilation.\n\n### Color-coded output on Windows\n\nColors are a big deal when reading ClojureScript compiler output, but Windows\nconsoles don't support ANSI color codes. This limitation is commonly corrected by\ninstalling ANSICON:\n\n1. Download and unzip [ANSICON](https://github.com/downloads/adoxa/ansicon/ansi160.zip) anywhere.\n2. Open a command prompt (Run as administrator).\n3. Navigate to the unzipped folder.\n4. cd x86 or x64 (depending on whether you have 32-bit or 64-bit machine, respectively)\n5. Run `ansicon -i` to install.\n\nAfterwards, you should get colored output from all future console sessions that use ANSI color codes.\n\n## Hooks\n\nSome common lein-cljsbuild tasks can hook into the main Leiningen tasks\nto enable ClojureScript support in each of them. The following tasks are\nsupported:\n\n    $ lein compile\n    $ lein test\n    $ lein jar\n\nTo enable ClojureScript support for these tasks, add the following entry to\nyour project configuration:\n\n```clj\n:hooks [leiningen.cljsbuild]\n```\n\nNote that by default the `lein jar` task does *not* package your ClojureScript\ncode in the JAR file. This feature needs to be explicitly enabled by adding\nthe following entry to each of the `:builds` that you want included in the\nJAR file. `lein uberjar` derives its behavior from `lein jar` and will include\nthe ClojureScript as well if enabled.\n\n```clj\n:jar true\n```\n\n\u003e **Debug Note:** There is a known issue (#366) where the `lein uberjar` task fails\n\u003e to build when using hooks and a cljsbuild configuration within an `:uberjar`\n\u003e profile. Instead of hooks, you can use `:prep-tasks` as an alternative:\n\u003e\n\u003e```clojure\n\u003e:prep-tasks [\"compile\" [\"cljsbuild\" \"once\"]]\n\u003e```\n\n## Multiple Build Configurations\n\nIf the `:builds` sequence contains more than one map lein-cljsbuild\nwill treat each map as a separate ClojureScript compiler configuration,\nand will build all of them in parallel:\n\n```clj\n(defproject lein-cljsbuild-example \"1.2.3\"\n  :plugins [[lein-cljsbuild \"1.1.8\"]]\n  :cljsbuild {\n    :builds [\n      {:source-paths [\"src-cljs-main\"]\n       :compiler {:output-to \"main.js\"}}\n      {:source-paths [\"src-cljs-other\"]\n       :compiler {:output-to \"other.js\"}}]})\n```\n\nThis is extremely convenient for doing library development in ClojureScript.\nThis allows cljsbuild to compile in all four optimization levels at once, for\neasier testing, or to compile a test suite alongside the library code.\n\nYou can optionally assign an ID to a build configuration and build\nonly that one:\n\n```clj\n(defproject lein-cljsbuild-example \"1.2.3\"\n  :plugins [[lein-cljsbuild \"1.1.8\"]]\n  :cljsbuild {\n    :builds [\n      {:source-paths [\"src-cljs-main\"]\n       :compiler {:output-to \"main.js\"}}\n      {:id \"other\"\n       :source-paths [\"src-cljs-other\"]\n       :compiler {:output-to \"other.js\"}}]})\n```\n\n    $ lein cljsbuild auto other\n\nIf you want IDs for all of your build configurations, you can specify\nthem as a map instead of a vector:\n\n```clj\n(defproject lein-cljsbuild-example \"1.2.3\"\n  :plugins [[lein-cljsbuild \"1.1.8\"]]\n  :cljsbuild {\n    :builds {\n      :main\n      {:source-paths [\"src-cljs-main\"]\n       :compiler {:output-to \"main.js\"}}\n      :other\n      {:source-paths [\"src-cljs-other\"]\n       :compiler {:output-to \"other.js\"}}}})\n```\n\nYou can also build multiple configurations at once:\n\n    $ lein cljsbuild auto main other\n\nSee the\n[example-projects/advanced](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/example-projects/advanced)\ndirectory for a working example of a project that uses this feature.\n\n## REPL Support\n\nLein-cljsbuild has built-in support for launching ClojureScript REPLs in a variety\nof ways. See the\n[REPL documentation](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/doc/REPL.md)\nfor more details.\n\n## Testing Support\n\nLein-cljsbuild has built-in support for running external ClojureScript test processes. See the\n[testing documentation](https://github.com/emezeske/lein-cljsbuild/blob/1.1.8/doc/TESTING.md)\nfor more details.\n\n## Extended Configuration\n\n### Custom warning handlers\n\nYou can place custom warning handlers for the ClojureScript compiler under the `:warning-handlers` key. The value should be a vector of either 1.) fully-qualified symbols that resolve to your custom handler, or 2.) anonymous functions that will get eval'd at project build-time.\n\n```clj\n(defproject lein-cljsbuild-example \"1.2.3\"\n  :plugins [[lein-cljsbuild \"1.0.4\"]]\n  :cljsbuild {\n    :builds {:id           \"example\"\n             :compiler     {}\n             :warning-handlers [my.ns/custom-warning-handler ;; Fully-qualified symbol\n                                ;; Custom function (to be evaluated at project build-time)\n                                (fn [warning-type env extra]\n                                  (when-let [s (cljs.analyzer/error-message warning-type extra)]\n                                    (binding [*out* *err*]\n                                      (cljs.analyzer/message env s))))]}})\n```\n\n\n## ClojureScript Version\n\nAfter configuring lein-cljsbuild, `lein deps` will fetch a known-good version of the ClojureScript compiler.\nYou can use a different version of the compiler via a local clone of the ClojureScript git repository.\nSee [the wiki](https://github.com/emezeske/lein-cljsbuild/wiki/Using-a-Git-Checkout-of-the-ClojureScript-Compiler) for details.\n\n##  License\n\nSource Copyright © Evan Mezeske, 2011-2013.\nReleased under the Eclipse Public License - v 1.0.\nSee the file COPYING.\n\n## Contributors\n\nA big thank you to all [contributors](https://github.com/emezeske/lein-cljsbuild/graphs/contributors) who help to make this project better.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femezeske%2Flein-cljsbuild","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femezeske%2Flein-cljsbuild","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femezeske%2Flein-cljsbuild/lists"}