I wanted a preprocessor that I could use with Javascript, but I couldn't find a good one that struck the right balance between simple and powerful, so I made my own.
In a nutshell, QPP allows you to use "#include" directives in any text file to add in the content from external files. Right now it's pretty barebones, but I'm hoping to add more features in the near future.
This statement allows you to add the contents from one file into another file. Just specify the filename in quotes, and QPP will go fetch that content and plop it into your file. You can even use URLs!
Examples:
#include "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"
#include "classes/MyClass.js"
//#include "classes/MyClass.js"
java -jar qpp-1.0.jar inputfilename.js outputfilename.js
QPP will cache remote files for faster processing, so you can clear the cache by deleting .qpp-remote-cache. At some point, you'll be able to pass in a commend-line flag to bypass the cache, but for now, you'll have to delete the folder manually.
Yep. Here's a short list:
- Since you're processing into a single file, the app assumes that you only want to include each file once. This way, you don't end up with a bunch of repeated code.
It's not done yet :) Here's a to-do list:
- Add a flag to bypass the cache
- Build out a better command-line interface (help text, better error messaging, etc.)
- Add #IFDEF statements for conditional compilation.
- ???
- Profit.