This happened to me before, but I was just learning sass so I assumed it was something I did wrong. I don’t think so anymore. I just duplicated a page (BS5) and all of my SCSS files were set to no visibility on any pages on the original copied from. When I went to that new page, all of the visibility settings for the SCSS files were reset to be visibile on ‘All’ pages except for the Index page.
All of these settings should retain the settings from the copied page. I truly hope I won’t have to reset every single SCSS file every time I copy a page lol. That would be madness since I have them all set to not be viewed by any page due to the import setup so I don’t see duplicated code all over the place.
I’m guessing you were using the “Show on all pages except” option and had selected all existing pages. When you add a new page, the selection in the visibility dialog remains the same as it should. The new page should not automatically be added to it.
You mentioned @import, so I’m guessing you’re referring to partials. You don’t need to use visibility to hide partial SCSS files, you just need to rename them so that they start with an underscore and they will not be compiled on their own. Hope this helps!
Well bust my britches I think I may have just learned something …
Firstly that the file I duplicated wasn’t set up how I thought it was, definitely user error as I didn’t have all the visibilities set up in that one sorry for that mistake.
maybe I’m making this more complicated than it needs to be? I’ve been wracking my brain the past couple months or so with the fact that I can never tell which SCSS file classes are coming from and I have to organize extremely carefully if I want to find what I’m looking for later. But … do correct me if I’m wrong …
Maybe the idea is that even though I see duplicated classes in the styles window, only one of them is actually being used at export due to how I have it set up. I’m using the “@use” not the “@import” and I may have said import before, my mistake there as they are kinda the same.
Anyways, do I even have to hide these files then? If the export will be compiling them into the main SCSS file (I named custom.scss), then it don’t matter and I could leave them visible and then I wouldn’t have to pull my hair out trying to find out what file I actually have the code in? That duplicate will show up in the Styles window then telling me where it really is right? Yet it isn’t hurting anything really by being visible … I’m guessing at all this lol. With them invisible everything shows up as my “custom.scss” file no matter what file it’s really in since they are being “@use” in that main scss file.
Let me know if I’ve been going about this wrong or backwards. I’ve tried to get that part verified for a while now, but can’t seem to get any answers on it. It’s all fairly new to me yet so I haven’t created any lasting habits that can’t be changed lol. Would be nice not to have to do all this visibility stuff!
Unfortunately, there is no way to know which file the styles come from as they are compiled in one file. I will try to explain with an example.
We have two files:
Both files are visible and are not marked as partials. Both files will be compiled and will result in styles.compiled.scss and partial.compiled.scss being exported. This will result in duplicate code.
If we change the visibility settings of partial.scss so that it’s not visible on the page, only styles.scss will be compiled and exported - no duplicated code but a hassle to maintain.
If we mark partial.scss as a partial, i.e. rename it to _partial.scss and leave it visible on all pages, only styles.scss will be compiled and exported - no duplicated code and doesn’t need any maintenance really.
Either way, if you see the styles from a partial SCSS file in the Styles tab, they will be exported.
Hope this clears it up!
Thanks very much for that explanation. That definitely clears things up and tells me I was already doing that and have been on the right track.
So all this information in hand leads me to the question/suggestion that I was originally going to post a few weeks ago and got side tracked lol. I’ll post it in the Ideas section. Thanks so much for all your help. This old brain needs all it can get! Most appreciated!