SCSS of page template being imported on all pages


I’ve a page that it’s using the wordpress default template.

Then I’ve created a new template called template-sidebar, created my _template-sidebar.scss on the layouts folder and imported it on main.scss

What I’ve noticed is that on my page without any template the scss has being override by the template-sidebar.scss file.

For what I understood on the documentation only the templates scss should be imported ? Is that a bug?

I’ve found it out that the SCSS files aren’t imported like the JS files… This is a bit confusing for new users at Sage to be honest. It would be awesome if it works exactly like the PHP and JS files when creating new templates. A good suggestion maybe for Sage 10?

If you think this would be useful functionality, we’re always happy to review pull requests:

Why is this confusing? The JS is still included on all pages… it’s only executing specific JS based on the route. That has nothing to do with stylesheets.

If it helps, sage 9 doesn’t load any specific JS or CSS/SCSS per page. These “per page files” still get compiled/processed into 1 main file which is loaded onto every page. The only way you can do things like this is to update this file to create these specific files you need and enqueue them on the relative pages.

A bit OT question/discussion here, but the default sage javascript uses basically two times a jquery function. Wouldn’t it be better to replace these with vanilla js so no jquery is required (at least on front end, when not logged in)?