Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When my SCSS file is automatically compiled, it also recompiles every SCSS file in my entire workspace #31

Closed
gavin310 opened this issue Feb 3, 2021 · 6 comments
Labels
duplicate This issue or pull request already exists question Just a question

Comments

@gavin310
Copy link

gavin310 commented Feb 3, 2021

I'm not sure what I can provide here. My SCSS file contains @import statements that import files, but only files residing in the current folder. When I saved my changes it searched for every single SCSS file in my workspace (which contains a WordPress themes folder and the plugins folder) and recompiled them. In total it recompiled about 150 SCSS files throughout my project.

If you want I could send you my SCSS files to a personal message.

@gavin310
Copy link
Author

gavin310 commented Feb 3, 2021

Actually it recompiles every SCSS file when I click "Watch Sass" and also when I make changes and save.

@glenn2223
Copy link
Owner

When the extension was first created by Ritwickdey his initial thought was to keep it simple. This meant that when a partial file (that's any file beginning with a _) processes all files within the document. You can use the various setting to choose which files to compile.

Examples:

  • forceBaseDirectory when you only want to compile a specific folder
  • includeFiles when you only want specific files to be processed anytime a partial is saved (accepts glob patterns)
  • excludeFiles to exclude based on glob patterns

Actually it recompiles every SCSS file when I click "Watch Sass" and also when I make changes and save.

This can be disabled with the compileOnWatch setting

Can you confirm that this is what your problem is/you're after => #17
If so, I'll close this as duplicate and re-open the original issue with more weight behind it

@gavin310
Copy link
Author

gavin310 commented Feb 3, 2021

Oooh ok. Let me just provide a quick example so I can make sure this is correct. I was a bit surprised when 150 SCSS files rendered.

Here's a sample structure of my workspace:

- theme
  - themeName
    - css
	  - main.scss
	- js
	- img
- plugins
    - someRandomPlugin
	  - assets
	  	- css
		  - src
		  	- styles.scss
	- anotherPlugin
	  - styles.scss
	- yoastSEO
	  - folders
	    - lots-of-folders
		  - a-deep-scss-file.scss
	- myPlugin
	  - assets
	    - main.scss
		  - _includeFile.scss
		  - _anotherInclude.scss (this is the file I'm saving)

So when I saved "_anotherInclude.scss" it rendered every single SCSS file that's in that tree.

Is that really what it's supposed to do with the default settings?

@glenn2223
Copy link
Owner

That's right, every file that's not a partial will be processed (based on default settings), as per the below

- theme
  - themeName
    - css
	  - main.scss <-- THIS ONE
	- js
	- img
- plugins
    - someRandomPlugin
	  - assets
	  	- css
		  - src
		  	- styles.scss <-- THIS ONE
	- anotherPlugin
	  - styles.scss <-- THIS ONE
	- yoastSEO
	  - folders
	    - lots-of-folders
		  - a-deep-scss-file.scss <-- THIS ONE
	- myPlugin
	  - assets
	    - main.scss <-- THIS ONE
		  - _includeFile.scss
		  - _anotherInclude.scss (this is the file I'm saving)

When he initially created the extension it was designed for small packages of SCSS, not those embedded in larger projects. Hence why, with me (and the community) moving this project forward, we now have a forceBaseDirectory attribute. As well as moving towards a save process that knows the links between files (as per #17)

@gavin310
Copy link
Author

gavin310 commented Feb 3, 2021

Ok that actually makes sense. Thanks a lot for the explanation!

@glenn2223
Copy link
Owner

No worries, glad I could help

Closing as (essentially) a duplicate of #17

@glenn2223 glenn2223 added duplicate This issue or pull request already exists question Just a question labels Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Just a question
Projects
None yet
Development

No branches or pull requests

2 participants