XF 2.0 [SOLVED] Custom CSS stylesheet in template

SamJakob

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

1520279283723.png
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.
 

Steve F

Well-known member
Try
Code:
<xf:css src="templatename.less" />
Also did you create the template in ACP?
 

Jeremy P

Well-known member
@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

Member
@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.
 

SamJakob

Member
Solved: I rebuilt the addon from the CLI:
Bash:
php cmd.php xf-addon:rebuild <addon>
Then the template was recognised.
 

SamJakob

Member
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