[dev] CSS hook

Sebastian Birnbach birnbacs at gmail.com
Fri Jul 28 10:59:18 UTC 2017


2017-07-26 21:38 GMT+02:00 Sebastian Birnbach <birnbacs at gmail.com>:

> I am working on a whups Block for which I want to use custom CSS
> definitions.
>
> I created a whups/themes/default/dossier.css file
> I also created a loader function in whups/config/hooks.php:
>
> ...
>     public function cssfiles($theme)
>     {
>         return array(
>             '/usr/local/www/apache24/data/whups/themes/default/dossier.css'
> =>
>             'whups/dossier.css'
>         );
>      }
> ...
>
> The loader function does get executed no problem but there seems to be a
> missing step. How do I use the URI inside the Block to make the CSS file
> load? (Sorry if this is a trivial question, I'm still working my way
> through the application stack)
>

It got better when I re-enabled JS caching and temporarily disabled
CSS-caching. I started to see the CSS inclusion statements in HTML source
and could debug from there.

The URI needs to match the file location when requested from the webserver
of course.
In the above example the URI should be "/whups/themes/default/dossier.css".
Beats me why both the file location and the URI are relevant in the hook,
though.

Case closed, thanks to all.


More information about the dev mailing list