Clean Javascript modules for front-end development
Find a file
2020-01-10 18:44:24 +01:00
demo Fix indentation typo 2020-01-01 19:46:32 +01:00
src Also expose a function to retrieve source code while printing errors and logs and logs 2020-01-10 18:40:44 +01:00
tests Add static test directories 2020-01-10 18:44:24 +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 Clean interface and expose a library, change sjw Main to use this library 2020-01-10 15:54:15 +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 Write a generator for huge source projects to test performance on large inputs 2020-01-10 18:42:13 +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.