demo | ||
src | ||
tests | ||
.gitignore | ||
CHANGELOG.md | ||
LICENSE | ||
README.md | ||
Setup.hs | ||
SJW.cabal |
SJW
The Simple Javascript Wrench is a tool made to compile a set of independant Javascript modules into a single executable javascript file as expected by a webbrowser. It allows you to write (relatively) clean Javascript and to package it into one single script that will run once the page loading it is loaded.
How to install
SJW can be compiled and installed from a version of this repository by issueing the following commands
$ cabal new-update
$ cabal new-build
$ cabal new-install sjw
Using it
SJW is a sort of compiler that expects the path to a source directory as argument and will output (on stdout
or at the path given with the usual -o
option) a script containing all the code required by the Main
module.
The demo/
directory is a simple example of this mechanism (I even committed the output main.js
by accident but it's actually useful because you can try and generate it locally and check that you get exactly the same result). Run the following from this directory (if you're not used to haskell projects handled with cabal, make sure you have ~/.cabal/bin
in your $PATH
variable) :
$ sjw demo/src -o demo/main.js
Ask sjw --help
to read more about available options or to print the version of SJW you're using.