compile.js v1.1.4
compile.js
A quick and easy way to watch, compile, and serve jade files.
compile.js [--help | --version | -g <name> [-r <repo>] | -d [-i <infile>]
[-o <outfile>] [-p <port>] [--pretty-print] | -c [-i <infile>]
[-o <outfile>] | -w [-i <infile>] [-o <outfile>] | -s
[-i <infile>] [-p <port>]]
Options:
--generate, -g, --gen generate a new project
--repository, -r, --repo specify template repository for new project
--compile, -c, --comp compile a jade file
--watch, -w watch and compile a jade file
--serve, -s serve input file
--develop, -d, --dev watch, compile, and serve a jade file
--infile, -i, --in the input jade file
--outfile, -o, --out the output html file
--port, -p port to serve outfile on
--pretty-print, -P pretty print output
--help, -h display help information
--version, -v display version information
Installation
Just run sudo npm install -g compile.js
.
The command compile.js
should automatically be added to your PATH
.
Examples
Project Generation
compile.js -g new-project
This creates a new instance of 5paceManSpiff/spa-template
under the new-project
directory.
compile.js -g bloop -r https://github.com/5paceManSpiff/blip
This uses the -r
flag to specify a project template repo to clone. In this case it clones 5paceManSpiff/blip
to the bloop
directory.
Project Development
compile.js -d
This serves index.html
on port 8000. index.html
is compiled from the default input index.jade
every time a change in index.jade
is detected.
compile.js -d -i input.jade -o output.html
This specifies the input file and output file with the -i
and -o
flags.
compile.js -d -p 8080
This specifies the port used to serve the output file.
compile.js -d -P
This pretty prints the output html file.
Jade Compilation
compile.js -c
This compiles index.jade
to index.html
.
compile.js -c -i input.jade -o output.html
This compiles input.jade
to output.html
.
File Serving
compile.js -s
This serves index.html
on port 8000.
compile.js -s -i input.html -p 8080
This serves input.html
on port 8080
.
Watching Jade Files
compile.js -w
This compiles index.jade
to index.html
whenever changes are detected in index.jade
.
compile.js -w -i input.jade -o output.html
This compiles input.jade
to output.html
whenever changes are detected in input.jade
.
Project Templates
Any git repository can be used as a project template using the -r
flag.
The default is my spa-template
repository.
Its directory structure looks like this.
.
|-- LICENSE
|-- README.md
|-- assets
| |-- main.js
| `-- style.css
|-- index.jade
`-- package.json
Projects currently using compile.js
project | src |
---|---|
blip | github |
whipped | github |
aaronlandis.io | github |