Stylesheet entry point to serve LESS files
To ease development of LESS stylesheets and avoid to recompile at
each edit into CSS, we provide a stylesheet.php entry point which
invoke plessc to compile and print on the fly the stylesheet.
We introduce an environment variable APPLICATION_ENV to allow to
distinguish between dev and prod environment. A follow-up change
should disable this feature in prod.
Web server could redirect requests to stylesheet handler.
The handler accepts two GET parameters:
- resource to identify what we need to serve ('less')
- the name of the resource
By default, that matches resources/assets/<type>/<name>.<type>.
Two classes are offered. The first, Assets, describe the structure
of the assets in general. The second, Stylesheet, focus on the task
to serve a stylesheet. Both are static classes.
Assets methods:
- getAssetsDirectory
- getAssetExtension
- getAssetFilename
- isValidAssetName - Sanity check
Stylesheet methods:
- printHeaders
- compileLess
- printLess
- print404Headers
- print404
- handleRequest - Page entry point
Known issues:
- plessc doesn't compile Bootstrap