Check ma sprockets!

Ever since i heard of Sprockets on Twitter i wanted to use it in my apps. Unfortunatly i am not into Ruby.
Sprockets is a Ruby library that preprocesses and concatenates JavaScript source files. It takes any number of source files and preprocesses them line-by-line in order to build a single concatenation. –
I wanted to port it to PHP or find clever ways to use it in CakePHP (shell?). But before you start something like this you should check if there isn’t already a project and so i found PHPSprockets from Stuart Loxton. PHP Sprocket is a port of Sprockets. Cool.. so the meat of sprockets is already available :)
PHP Sprockets currently acts as a transparent proxy as default and caches results. Because of this you do not have to initialize any classes in your app and sprocket stays separate.
Thanks to GitHub i just forked the project and began pimping Stuarts class.
Here are the major differences from the orignal port:

  • The main class file has been renamed to “Sprocket”
  • Commands are now classes. It is easy to extend Sprocket with new commands.
  • Instead of YML this fork uses INI files for providing constants.
  • Easy to extend due more abstraction, setters and a array based option interface
  • Seperate render stage (with autoRender option to mimic the original render-on-construct).
  • Also works with other files, like CSS and whatever you want to concat.. (see demo)
  • Selective minification for JS and CSS out of the box. Just add “minify” (see demo files)
  • Fully documented sourcecode

I also added a demo and there is more info about my rewrite in the repo readme.
Enjoy! –">