Re: [photon.users] Assets in Photon, the best way to manage them
- 2011-06-15 @ 08:50
A couple thoughts...
I would say the easier the better. At file-serving time, the standard
behaviour should be simple routing with a far away expiration time. I'm not
really fond of the "from disk" idea (or /dev/shm maybe ?).
At PHAR "compile" time, it would be nice to be able to apply specific
actions to specific files ("foo.png") or file patterns ("*.js"), such as :
- compress each PNG file with ImageMagick
- minify each JS or CSS file with some tool
- any custom command you can think of
Delivering a couple default behaviours would be nice. People could also
exchange these things, if they're easy enough to encapsulate.
On Tue, Jun 14, 2011 at 9:40 PM, Loic d'Anterroches <email@example.com> wrote:
> lately, I have been thinking about the assets in Photon. The work
> started with .phar approach to bundle the assets in the archive. But of
> course we can do better. Suppose you need to load 2 css files and 3 .js
> files to render a page. What do you think would be the best approach?
> - routing with md5/crc32 of the content in the name with unlimited time
> - automatic bundling of let say 3 of them into one with md5 too.
> - minification.
> I am thinking about a smart template tag to load the css and js and
> depending of the context get the data out of the .phar or from the disc,
> minified or not. For example, you want to run "from disc" when developing.
> What is your experience with the 1000's of frameworks doing such clever
> things? What do you think would be the best way?
> Indefero - Project management and code hosting - http://www.indefero.net
> Photon - High Performance PHP Framework - http://photon-project.com
> Céondo Ltd - Web + Science = Fun - http://www.ceondo.com