Phalcon AssetPipeline

I am somewhat fresh to Phalcon. Just had my first PR merged today \o/ but I have an idea for a way to manage assets without needing gulp or grunt.

I come from Ruby on Rails and there is a strong idiom of the AssetPipeline via Sprockets. I don't think on average we need that much power up front but I built up a prototype of an AssetManifest Loader that uses on the built in asset manager stuff to abstract the assets per collection be defining a something.manifest file with an app/assets/js/.

https://github.com/ninjapanzer/phalcon_php_fullcalendar/pull/1

For reference here is the walk through: We define the assetManifest service https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/public/index.php#L65-L74 Specify Manifests: https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/app/assets/js/application.manifest Output css and js based upon a combination of the type and manifest filename: https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/app/views/layouts/index.volt

The loader itself is pretty direct but could learn to be smart enough to handle different compliation strategies and DI injectable preprocessors https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/app/assets/ApplicationManifest.php

Of course at this point I would rather use the FFI if Zephir has it to directly access the precompiled version of most of these like libsass and such.



2.2k
edited Jun '17

to help, this is links to repo ;o))

https://github.com/ninjapanzer/phalcon_php_fullcalendar

https://github.com/ninjapanzer/phalcon_php_fullcalendar/pull/1

https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/public/index.php#L65-L74

https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/app/assets/js/application.manifest

https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/app/views/layouts/index.volt

https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/app/assets/ApplicationManifest.php

Yep I had too much faith in the MD parser

to help, this is links to repo ;o))

https://github.com/ninjapanzer/phalcon_php_fullcalendar

https://github.com/ninjapanzer/phalcon_php_fullcalendar/pull/1

https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/public/index.php#L65-L74

https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/app/assets/js/application.manifest

https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/app/views/layouts/index.volt

https://github.com/ninjapanzer/phalcon_php_fullcalendar/blob/5ff9865c558f97be721e53df470e46f01c7d3d0a/app/assets/ApplicationManifest.php