XF 2.0 [SOLVED] Custom CSS stylesheet in template

SamJakob

Active member
How can I create a custom CSS stylesheet for my addon's template?

1520279283723.webp
I tried simply including a css file in the templates folder but this isn't recognised (is there anything else I need to do?)

XML:
<xf:title>Link Minecraft Account</xf:title>
<xen:require css="continuity_general.css">

<br>

...
As you can see, I do xen:require it in the template.
 
@SamJakob That would work on XF1. For XF2:

HTML:
<xf:css src="continuity_general.css" />

You can use LESS too if you want, by renaming the template continuity_general.less
 
@SamJakob That would work on XF1. For XF2:

HTML:
<xf:css src="continuity_general.css" />

You can use LESS too if you want, by renaming the template continuity_general.less
Yeah I guessed from the examples but I prefer SCSS, so I figured I'd generate the stylesheets externally.
 
Solved: I rebuilt the addon from the CLI:
Bash:
php cmd.php xf-addon:rebuild <addon>

Then the template was recognised.
 
Additional note:
XML:
<xf:css src="continuity_general.css" />
^ This is how you include CSS stylesheets in XenForo 2 (so if your CSS isn't showing up, that's what went wrong).
 
Top Bottom