We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Alternative Assets Manager

I've made an alternative Assets Manager. This Assets Manager regenerates the files ONLY if the files have changed since the last time they were compiled, thus eliminating overhead. It is compatible with Cssmin and Jsmin from Phalcon, so it's still very fast since those minifications happen in C.

https://github.com/Swader/bitfalls_utils/blob/master/Bitfalls/Utilities/AssetsManager.php

I haven't added the whole thing to composer yet, but the Asset Manager itself is in use on all 17 of my Phalcon sites (autosusados.hn and derivates, look at links near bottom) and it works like a charm.

Just looking over your code, it looks like you took a similar approach as ASP.NET by append a hash, generated by the name and time of last change to the file, to name of the file. I recently started playing with ASP a few weeks ago and thought their built-in Bundling and Minification (https://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification) was brilliant! So finding the Asset Manager in Phalcon got me really excited about the framework and felt it was worth a second look. Your version takes it too the next level! Great work and I cannot wait to play with it.

Thanks! I had no idea ASP did it this way. I've been using this asset manager for years in my projects, but I had utilized PHP written filters so far. Now that Cssmin and Jsmin are implemented in C via Phalcon, I've just reworked it slightly to accept those. In fact, most of the classes in that repo are helper classes I've been using for quite some time, feel free to look around.



8.6k

cool implementation, but it lacks one feature that the Phalcon library has it: collections. I cannot group files into groups.