My Clojurescript project is starts with three files -- an index.html, a css file, the hand-written .cljs code.
When cljsbuild builds the .cljs file into a .js file, it puts it in an arbitrary location. I'd like to also move the index.html and css files there too.
The reason I want this is so I can have multiple profiles, and easily load both. I have a dev
profile where the javascript isn't optimized, and a release
profile that does optimize javascript. But switching between them is annoying -- I have to somehow take the single existing index.html file and change the javascript file it's pointing at. (If I have two index.html
files, each pointing to a different javascript file, making a change to one html file means duplicating the change in the other)
I'd rather have two builds:
dev
build builds to project/dev
.
release
build builds to project/release
.
Both builds would have index.html
, style.css
, and compiled.js
files. Is there any way to make this happen?
For doing that I think you are going to need additional tooling to your project.
Frontend tooling is a tough world with lots of alternatives and workflows each with their tradeoffs.
The simplest way would be having a makefile and invoke it when you want HTML and CSS copied/compiled. That should get you started but it is hard to get working on Windows.
For a established cross platform solution I'd look into integrating grunt to the workflow. With grunt you can easily have a file watcher copy/compile your HTML and CSS to your folders and even have the files minified/linted. The tradeoff is a steeper learning curve and initial setup of the project.
There are lots of options but not any cljs specific tooling that I know of.