#PHP CommonJS runtime and compiler
That means you can do things like:
require('widget').stuff() without any on-demand script loading.
Then you can compile it all into a single compressed .js file for deploying to your server or CDN.
It consists of two parts:
- a runtime processor (dev)
- a compiler (live)
The runtime processor allows you to debug your code much the same as you normally would. It loads your modules as separate js files to aid debugging, and hardly touches your source code during development.
The deploytime compiler reduces an entire 'application' to a single .js file and compresses it with Google's Closure Compiler (included)
One very simple example is included for now.
example/example-script.jsis a really simple application that calls in one module.
example/example-page.phpshows how to run this script during development.
example/example-build.shshows how to use the command line compiler for deployment.
Built-in .js modules
- Framework agnostic.
- No configuration files.
- No exotic PHP requirements; just JSON extension and CLI SAPI.
- Only tested on PHP 5.3.5 so far - but it's not fancy.
- Java is required to execute Google Closure Compiler; assumed to be at
- Bundle in some common JS utilities - maybe.
- Support Google Closure remote API for users without Java.
- Improve caching - curently any dependency change recompiles everything.
- Watch out for
- Point your php cli at a suitable .ini file - it may differ from your web server.
- Always add a "--" separator before any php command line arguments