-
Notifications
You must be signed in to change notification settings - Fork 31
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
Can't exclude partials from being build on save. #45
Comments
Damn thanks for you comment. I did not even know there was a pre-definition for "partials" file names. I just built a "exclude .inc.scss" filter on my own. (Spend an hour reading the docs? NAH. Spend two days hunting for errors? YAY) This was the filter I used to exclude .inc.... files: There used to be a filter for _ in this project: cb08398 I played around with this for quite some time now and did not yet find out why I will give up for now but wanted to leave you with my findings so far. |
This likely is a matter of tweaking the regex pattern, or may be we need to make this a list of patterns than just having to overload everything to one field. I can look into this — in order to reproduce this on my side, what patterns are you trying to exclude? |
@paweuek is looking to exclude all files starting with _ |
However I want to mention that it is quite smart as mentioned in #44 to still trigger a build process even when editing partials. This must then be tweaked in the building tool (rebuild all files). |
@alexnj @PhoenixIV I've managed to fix my issue by adding the code from this pull request:
later on I learned that I can watch my main scss file with dart sass so I don't really need to build on save ;__; |
@PhoenixIV I'm in agreement with you that a partial stylesheet file update should result in a build of the CSS bundle. The build step should point towards the CSS build command, and it would pick up the modified partials file. This is one of the workflows possible. I'm curious when would we modify an include file but not want an associated build-artifact be updated? @paweuek sounds like you are attempting to do something similar, so would be good to know. @paweuek yes, file watchers are an alternative pattern to this if the tradeoffs work for your specific workflow (i.e., having to start and maintain a parallel run process, inotify limits, memory and cpu usage on watching, etc.). Both are useful patterns! Regardless of the workflow (which can vary developer to developer, runtime etc.), the plugin should allow you to define a pattern by which a build command can be are triggered, when the file being saved matches the pattern. Thus by definition you should be able to exclude some files/patterns from it. This is currently achieved through a single regular expression pattern, but if it doesn't scale to your needs, we can and should enhance the field. |
The 'filename_ignore' option (#30) is something I currently question, as the existing regex for positive matching (should) already allow full control. Not saying it might not make things easier. Out of curiosity: If anyone knows why my pattern Edit: It came to me right after this message and I can confirm: My pattern did not work because it is matched against the full path of the file, not just the filename! @alexnj well thought reply |
I now created a working filename_filter that ignores files starting with _ Please note you may prefer rebuilding all files when editing partials, though (a message to those only reading this post detached from the previous) |
I created a build system that will update all affected files:
It will only rebuild files that are affected by changes made (because of the --update parameter). This requires this package's filename_filter to be the current default / trigger also for partials (files starting with _). The sass compiler is programmed in a way that it will not compile files in a directory starting with _ anyway. As mentioned by @alexnj you might prefer this over watching a directory constantly. |
I have already tried this setting:
"filename_filter": "(/|\\\\|^)(?!_)(\\w+)\\.(css|js|sass|less|scss)$",
but this makes all files to not build at all. I'm using Sublime Text 4 with newest dart sass and SASS build plugin. Any ideas What I might be doing wrong?
The text was updated successfully, but these errors were encountered: