I just noticed <h:outputStylesheet/>
has a converter attribute. After attaching a dummy (pass-through) converter to it, nothing happened. On closer inspection, it seems the converter isn't even called despite hitting the browser refresh button.
Is this attribute good for anything? Is it just there as a side effect of various design decisions?
The reason I ask is that it would be nice to perform some client- or server-side css processing with less or similar and I thought this attribute might help.
Is this attribute good for anything? Is it just there as a side effect of various design decisions?
That's indeed "by design" since the component extends UIOutput
. It does indeed not use the converter for anything.
The reason I ask is that it would be nice to perform some client- or server-side css processing with less or similar and I thought this attribute might help.
You can just use EL the usual way in CSS resources loaded by <h:outputStylesheet>
. This was initially implemented in order to resolve background image resources properly.
.some {
background-image: url(#{resource[images/some.png]});
}
The above example assumes the image to be in /resources/images/some.png
. If you're using a library, you need to prefix the resource name with libraryname:
.
.some {
background-image: url(#{resource[somelibrary:images/some.png]});
}
Which assumes the image to be in /resources/somelibrary/images/some.png
.
But other than that, you could basically use EL in the CSS resource for anything else. E.g. dynamically resolving colors, fonts and so on.
.some {
color: #{theme.color};
font: #{theme.font};
}
Where #{theme}
can be a session or maybe application scoped managed bean.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With