Look, Ma! No NodeJS! – a PHP front end workflow without Node
If you’re intimidated, exhausted or irritated by Gulp, Grunt, NPM, Yeoman, and all the other NodeJS tools that aim to help but often do the opposite, a good asset management workflow is possible in PHP, and this tutorial aims to prove it. In this article, we’ll go through a NodeJS-free PHP front end asset management setup.
What we’ll be doing
We’ll be adding asset management into a Slim 3 project. We’ll be using Rob Allen’s Slim3 Skeleton as a base “app”, along with:
- BowerPHP instead of Bower for installing assets
- markstory/mini-asset for minification
- Robo for resource tracking (watching for changes) and executing a rebuild (minification) when a change is detected
Why mini-asset and not Munee or Assetic? Because it’s dead simple – configure with an
.ini file, run, and it executes. No server alterations, no in-depth configuration, ready to go OOTB.
Note that Slim 3 is used here only as a base app, and doesn’t really matter in the whole picture – we won’t be using any of Slim’s particular functionality. As such, you can use any framework you want, or skip using a framework altogether. We’ll be using Homestead Improved as usual to set up a local dev environment.
git clone https://github.com/swader/homestead_improved hi_assets cd hi_assets sed -i '' "s@map\: \.@map\: $PWD@g" Homestead.yaml sed -i '' "s@Laravel@test@g" Homestead.yaml vagrant up vagrant ssh
Continue reading %Look, Ma! No NodeJS! – a PHP front end workflow without Node%