A complete, working sample project to demonstrate working code with external JavaScript dependency
Say you have a JavaScript library you need to include in a ClojureScript project. We have an
example file dino.js
we wish to depend on. The file dino-externs.js
shows how to tell the
Google Closure compiler about the dependency. The project.clj
file shows the right syntax to make
everything work as it should.
Project was created using lein new figwheel
Prior to running, you must install NodeJS dependencies:
./npm-install.bash # => downloads npm modules (saved in `./node_modules` dir)
To get an interactive development environment run:
lein clean ; lein figwheel
A browser window will open. Go to the developer console to view results.
To clean all compiled files:
lein clean # very important if build crashes & corrupt output files remain
To run Doo tests:
lein doo chrome test once # can also test using Chrome browser
lein doo chrome test # rerun the tests after every file edit (*** CURRENTLY BROKEN ***)
lein doo firefox test once # can also test using Firefox browser
lein doo firefox test # rerun the tests after every file edit (*** CURRENTLY BROKEN ***)
lein doo safari test once # can also test using Safari browser
lein doo safari test # rerun the tests after every file edit (*** CURRENTLY BROKEN ***)
# slimer won't work with current version of firefox as of 2019-4-4
# lein doo slimerjs test once # run the tests once and exit (note: not `phantomjs`)
# lein doo slimerjs test # rerun the tests after every file edit (*** CURRENTLY BROKEN ***)
# phantomjs is stuck with obsolete version of React as of 2019-4-4
# lein doo phantom test once # run the tests once and exit (note: not `phantomjs`)
# lein doo phantom test # rerun the tests after every file edit (*** CURRENTLY BROKEN ***)