Automating CSS in a plugin

Hi, I’m looking for advice on how best to implement a plugin that
contains some CSS. I would like the CSS to be automatically added to any
layout so that the only action I need to perform is installation of the

Is this possible?

The reason for this is that the plugin includes some view partials and I
want to provide default stylesheets so the partial’s contents look
reasonable by default.

If application-specific styling is then required the styles would be
customised by overriding in a controller’s style sheet outside the

I assume I will need a stylesheets folder in the plugin and have the
plugin installer copy any stylesheets into the application’s public
folder. What I don’t know is how I can have that stylesheet applied
automatically. They way I do this now is to use a helper in the layout
to include the stylesheet but I’d like to avoid that.

I have used the Styler plugin to help manage css before and it’s quite
good. I could customise that to include plugin css in its search.

But is there a better way to achieve this?


Would anyone be able to help with my query?

John L. wrote:

Would anyone be able to help with my query?

I’d say monkey patch the view helpers to inject your own code (css, js,
whatever) in it.