Skip to main content

Where can I find what's being imported into theme.scss and layout.html in the Collective theme?

I am creating a custom theme based on Collective and I only have a few things I want to change, but I'm finding it difficult to locate the source of some of the CSS and HTML.

Specifically, line 63 in layout.html includes: {% include "nav" %}

And then in line 527 of theme.scss there is an @include of something called mobile-nav.

Where are those? The final minified theme.scss makes it very hard to figure out the source of these bits of code.

Official response from

Hi Jason,

The Theme.scss and Layout.html files do indeed call upon other theme files using "@include" and "{% include %}" methods (respectively) to separate the theme into sections in an effort to make it easier to work with, but I can see how that might actually make it more confusing.


 

LAYOUT.HTML

In terms of the HTML (i.e. Layout.html), anytime you see {% include 'file' %} you can find that HTML file -- which we refer to as a 'partial' by going to Theme > Files and finding "_file.html".  So the "nav" section can be found by locating the file called "_nav.html". Below is a very simplified visual that I've made of how the layout.html file is laid out:

So Layout.html pulls in _nav.html, _signup_form.html and either _columns_1.html or _columns_2.html (depending on whether or not the sidebar is enabled on a page). Then _columns_1.html and _columns_2.html both use {% yield %}, which just pulls in the HTML from the "Template" section of each page individually.


 

THEME.SCSS


As for the Theme.scss file, it similarly pulls in correspondingly named SCSS files from the "Files" section of your theme. The "Templates" section of your theme attempts to list the commonly edited files and gives names that describe what they control, but not every file from the "Files" section is listed in the "Templates" section. What is important to note about the SCSS is this:

The Theme.scss file is the main SCSS file for your site. Tablet-and-desktop.scss defines a few styles that should overwrite styles in theme.scss when you are viewing the site on a tablet or desktop computer. Some additional stylesheets are pulled in to define specific styles that are applied to tables, forms, buttons, etc.., but those are labeled in the "Templates" tab of your theme.


 

I hope this helps!

Thanks,
Brian Palmer
NationBuilder Theme Support Specialist

Share this post

Showing 4 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.