kohana-assets
kohana-assets copied to clipboard
Request: Alternative to ::get() that returns <style></style> tags instead of <link> (similiarly for JS)
Would be nice to have something like get_inline() or the like. Note that HTML should be escaped between these tags.
Use case — for when paths are not resolvable, e.g. server-side PDF generation when additional HTTP requests from the PDF generator are not desirable.
This would also come in handy for sending emails.
I think the proper solution here is to have the 2 different layouts handle the way the assets are included. The website layout would wrap everything with HTML::style() or HTML::script(), the pdf layout would wrap in
I might need to change the assets config a little to be more informative but I think it would be the cleanest solution
I don’t like that very much as an API. Just think, how many people would just do a '' and forget to html::chars things? Then when a few CSS rules are broken, no one catches it for months… the assets module should handle this IMO.
it could also be put into the template as to allow mustache to automatically escape the contents
<style>
{{#styles}}{{style}}{{/styles}}
</style>
I will see what I can do though
If you're suggesting what Alan said (<style><?= file_get_contents($x)</style>
in the template), I have to agree that that's very ugly.