lolautruche / EzCoreExtraBundle

Extra features for eZ Platform (v1.x compatible with eZ Publish 5.4)
MIT License
28 stars 8 forks source link

Assetic package 'ezdesign' not working in a {% stylesheets %} block #10

Open alafon opened 8 years ago

alafon commented 8 years ago

This works :

<link rel="stylesheet" href="{{ asset("css/default.css", "ezdesign") }}" />
<link rel="stylesheet" href="{{ asset("css/another_sheet.css", "ezdesign") }}" />

This does not :

{% stylesheets
    'css/default.css'
    'css/another_sheet.css'
    package='ezdesign'
%}
    <link rel="stylesheet" type="text/css" href="{{ asset_url }}"/>
{% endstylesheets %}

Am I doing something wrong ?

lolautruche commented 8 years ago

Never tried this... Didn't know about package option. Do you have details on the error?

lolautruche commented 8 years ago

Anyway, I doubt this can work at all since Assetic compilation doesn't happen at run time, so you'll lose siteaccess context.

Best would be either to define assetic name assets instead, or just use Grunt/Bower

alafon commented 8 years ago

The package option is in the Asset Component, so it has nothing to do with assetic, you're right, sorry.

I don't know assetic very well but maybe custom filters could be used to lookup for the assets within the themes.

I was not able to find a lot of documentation regarding custom filter development and reverse engineering the source code of assetic is... well... 🗡 . Found this at least :

If you want to add some hints and finally think that it can be accomplished I might give a hand 😄

lolautruche commented 8 years ago

I don't know assetic very well but maybe custom filters could be used to lookup for the assets within the themes.

Yes, but as I said, Assetic will know nothing about your siteaccess config. When you run assetic:dump, you'll use default siteaccess, so it's useless when using themes with different siteaccesses...

That's why I suggest to use named assets.

Assetic is quite rigid as it can't use dynamic references (e.g. variables inside stylesheets/javascripts tags)