ASPAX is a simple command-line utility able to watch, compile, concatenate, minify and fingerprint web assets by interpreting a simple config file written in clear, human-readable YML syntax:
That's it. No complicated .initConfig(), no redundant code to describe tasks in JavaScript or CoffeeScript, just a simple YML file in your assets folder.
By looking at that file, ASPAX will:
- watch the folder and rebuild just the necessary files on changes; - compile, concatenate and copy files in development mode; - compile, concatenate, minify, fingerprint and copy files in production mode.
Deprecation notice
On May 23rd 2017 I've decided to stop maintaining ASPAX. See the note below for more info.
Installation
Most likely you'll want ASPAX installed as a global module:
npm install aspax -g
Plugins
To keep the global CLI module lightweight and dependency-free, ASPAX is using a plugin system to handle different source types such as CoffeeScript, LiveScript, client-side Jade templates, Stylus or LESS files, etc.
ASPAX will look for plugins in ./node_modules folder, so you'll have to install the necessary source handlers like this:
npm install aspax-coffee-handler
If you're running ASPAX in a Node.js application root folder, consider using the --save-dev option to avoid deploying the plugins to your production environment:
In addition, you can have a look at this demo repository to see a ready-made setup.
Config file syntax
The syntax of aspax.yml should be quite simple and human-friendly. Here are just a few tips:
$3
Just add the appropriate flags after the asset file name (the order is irrelevant):
o-- fingerprint | o---- minify | | | | V V -- --- js/app.js|fp|min: - ...
The flags will have no effect in development mode; however, in production:
- marking an asset for fingerprinting will add an UNIX timestamp like -1387239833024 before its extension; - marking an asset for minification will process it with UglifyJS2/CSS-optimizer and will also add .min before the extension.
Note: fingerprinting will work for anything, while minification only makes sense for JS and CSS files.
$3
Some source-handling plugins are also accepting flags (i.e. bare for CoffeeScript files). Use the same syntax:
o---------------------o | compile without the | | top-level function |--o | safety wrapper | | o---------------------o | V - ... ---- - scripts/source.coffee|bare - ...
$3
You can add any number of whitespaces around semicolons and flag separators for readability. All of the following are equivalent:
You can also add comments and even format your code like this:
# Main script js/app.js | fp | min : - lib/bootstrap.js - scripts/script-one.coffee | bare - scripts/script-two.coffee | bare - scripts/script-three.ls | bare
ASset PAckager, and X because ASPAX is an evolution of ASPA, a similar module I've built in the past.
$3
ASPAX brings in some breaking changes by simplifying the YML file syntax and introducing a plugin system to handle various source files. Simply updating ASPA wouldn't have been possible without annoying the happiness of too many users.
$3
I'm a strong advocate of open-source philosophy ~~and I'm also using this module in my Node.js projects, so I'll do my best to keep it up to date. If you notice ASPAX has outdated dependencies, most likely there's going to be an update soon.~~
A few years have passed since I've released ASPAX. Things have changed since then. The front-end landscape changed significantly. Gulp and Browserify became the _de-facto_ standards for a while, then everyone and their dogs started to use Webpack. Including me.
So I won't be maintaining ASPAX anymore. This is probably the last update (May 23rd, 2017). Yet, there are still hunderds on downloads on NPM. So if you're one of the people who badly need it for a legacy project and are willing and ready to take over, don't hesitate to drop me a message.
$3
To name just a few:
- LeasingSH.ro - the public website and a sales pipeline management application; - interiordelight.ro; - The insurance sales application for vector24.ro; - aspax.github.io (of course); - probably a lot more I don't know about, since ASPAX made 15k downloads in March 2015, according to NPM stats.
If you think your project should be listed here, don't hesitate to let me know about it.
Endorsing the author
If you find this piece of software useful, please tweet about it and endorse me on LinkedIn: