Whatever will look something like this:
<% if( someCriteria ) { %>
<stylesheet type="text/css" href="mypath" />
<%} %>
You can wrap it in an assistant or something else, but I don't think there might be a better practice or a “cleaner” way to make something so simple.
"I could include them in the site’s master, but I wonder if I can just include them ONLY when I need it."
Another way to look at this is that CSS files are cached by the browser, so you can enable it once and do it. Your visitors may have a slightly longer initial loading time, but if you keep your CSS files small, it will be barely noticeable. Very few advantages at work, making it dynamic.
source
share