Skip to content

Duct module for developing and compiling ClojureScript

Notifications You must be signed in to change notification settings

duct-framework/module.cljs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Duct ClojureScript Module Build Status

A Duct module that adds support for compiling ClojureScript for use in web applications.

Installation

Add the following dependency to your deps.edn file:

org.duct-framework/module.cljs {:mvn/version "0.5.0"}

Or to your Leiningen project file:

[org.duct-framework/module.cljs "0.5.0"]

Usage

Add the :duct.module/cljskey to your configuration and define a build:

{:duct.module/cljs {:builds {:client example.client}}}

This configuration will generate a file target/cljs/client.js from the example.client namespace. You can also define multiple namespaces to compile into a single output:

{:duct.module/cljs {:builds {:client [example.foo example.bar]}}}

The target/cljs directory will be added to the web application's static file handler, :duct.handler/file. This will make the JavaScript output accessible at /cljs/client.js.

Defining multiple builds generates multiple output files:

{:duct.module/cljs
 {:builds {:foo example.foo, :bar example.bar}}}

The above example would generate target/cljs/foo.js and target/cljs/bar.js.

When run in under the REPL profile, a server will be started that will update the compiled JavaScript each time the environment is (reset).

When run in under the main profile, the ClojureScript will be compiled for production. This will be slower, but produce a smaller output.

The module can be configured further with the options:

  • :output-dir - the directory to put the compiled JavaScript in (defaults to "target/cljs")
  • :asset-path - the web server path where the compiled JavaScript can be accessed (defaults to "/cljs")

License

Copyright © 2024 James Reeves

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

Duct module for developing and compiling ClojureScript

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •