Clean Javascript modules for front-end development
Find a file
2020-01-06 11:58:17 +01:00
demo Fix indentation typo 2020-01-01 19:46:32 +01:00
src Allow newlines in 'import' spacing to allow nice multiline imports and avoid inelegant too long lines 2020-01-03 09:49:08 +01:00
.gitignore First draft defining the structure of the program, needs to implement «imports» and the actual compilation 2019-12-30 12:16:05 +01:00
CHANGELOG.md Allow newlines in 'import' spacing to allow nice multiline imports and avoid inelegant too long lines 2020-01-03 09:49:08 +01:00
LICENSE First draft defining the structure of the program, needs to implement «imports» and the actual compilation 2019-12-30 12:16:05 +01:00
README.md Release v0.1.0 2020-01-01 20:01:17 +01:00
Setup.hs First draft defining the structure of the program, needs to implement «imports» and the actual compilation 2019-12-30 12:16:05 +01:00
SJW.cabal Compiled successfully with base == 4.11 2020-01-06 11:58:17 +01:00

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.