How do I find documentation explaining how to build a theme in Craft CMS? Where do I put my theme's assets, like my CSS and JS files, and how do I reference those assets in my Twig templates?
Generally speaking, Craft doesn't care where those files live, but I generally put all assets like CSS/SCSS, JS, etc in my
craft/templates folder. If you're using
gulp then you would compile your files out to the
public folder and link to them appropriately. If you're not compiling those, then they would need to live in the
You can read more about templating here:
I hope this helps! Craft is extremely flexible with almost no restrictions on what it can do.
Each Craft install is typically considered a discrete site, with its own design, information architecture, assets, etc.
This is why you might not be seeing information about "theming," per se.
However! Everything you need to start will be in
craft/templatesis how you generate HTML. Files in here often correspond to your sections and routes, but can also get rendered statically, just based on where you put them and what they're named. Check out the Routing documentation to decide how you want to set up your basic templates.
publicis the only folder in the installation that is accessible to the web, directly. All your CSS, JS, fonts, static images (i.e. a logo, icons), etc. will go. You can reference those files the same way you would a regular HTML file. Craft has some tags to help you with generating the proper URLs.
These are two of the primary concepts that you'll need to grasp to get started displaying your content.
One last (rather granular) note: Each type of content you define (
Sections) that has a URL will ask you for an Entry Template. That path is within your
craft/templates folder, and it'll automatically load the file when you visit that Entry's URL. (i.e. my "News" section might have
_news/post as its Entry Template, which corresponds to
craft/templates/_news/post.twig. The underscore prevents it from being directly accessed/rendered via