Codesleeve Asset Pipeline (refactor)

After kicking the boot around for a while I finally decided to re-factor the asset pipeline. The functionality is all in all the same but the code is easier on the eyes. However, I did bring in a lot of new features.

  • Config allows you to control caching interface
  • Config allows you to control directives
  • Config allows you to control which environments are concatenated
  • Config allows you to control mime types so you can combine javascripts and stylesheets in a single folder
  • Use a sprockets parser and generator to create the Rails-style asset pipeline functionality
  • Use relative paths in the manifest files
  • Use Laravel event listener to alter the configuration of the pipeline after package boot/start up
  • Use caching to speed up local development when using a lot of pre-processors (i.e. coffee, less, sass)
  • Use assets:generate to create static files in public/assets directory.
  • Completely customize the javascript_include_tag, stylesheet_link_tag composers
  • Completely customize the AssetController class
Regarding functionality, the Laravel asset pipeline can go toe to toe with the Rails pipeline.However, the last missing pieces are precompilers, minification and static file generation.

Currently, I use some open source php packages to handle coffeescript, less, scss, javascript and css minification. Those packages can break things and aren’t up to date.

As it stands right now the css minifier out of the box breaks when trying to minify Twitter Bootstrap 3 code because there is a @-moz-tag in the css. To get around this I use bootstrap.min.css because pipeline skips minification on .min. files.

New comers may not know this though and be confused or frustrated when all their styles break after trying to minify bootstrap css.

That’ll do for now pig, that’ll do.

that'll do pig
post by Kelt Dockins on 03/09/2014