Comments (18)
I have a few other issues to look at, but I will try my best to get a new release out by Monday.
from webcompiler.
I just pushed the version with this fix, please let me know if it resolved the issue.
from webcompiler.
I tested it in the scenario where I was having problems - works ok.
+1 for not wanting to modify too much code.
My approach in rewriting the module was to take into account Sass's coming deprecation of @import rules, but your approach of not wanting to rock the boat too hard makes sense too.
from webcompiler.
1.14.5 is now available and should address this issue
from webcompiler.
The fix works fine for basic @use rules, such as @use 'file1';
But not for those that use the full syntax, e.g.
@use 'file1' as *;
or
@use 'file1' with ($var1: 0);
from webcompiler.
@dgoldm Is there an exception or error shown?
from webcompiler.
No error shown.
Although apparently it's clear why it's not working, the match returned by the regex at line 53 of src/WebCompiler/Dependencies/SassDependencyResolver.cs includes all the characters up to the semicolon.
BTW, while investigating the issue I came across another problem with the above regex - if the @use or @import rule is commented out, it still matches, and the file is processed even though it shouldn't be.
from webcompiler.
@dgoldm That Regex is only responsible for identifying which files will trigger compilation on save, it has nothing to do with the actual compilation; the Sass CLI is used to compile the files; so, that regex doesn't need to be perfect.
from webcompiler.
Isn't that is precisely the issue? Currently when a @used file (which has an "as" or "with" clause in the line referencing it) is saved, the compiler isn't triggered.
(I noticed that line because it's the one that you changed in the commit that fixes the OP)
from webcompiler.
BTW, for now I found a simple workaround, taking advantage of the 2nd problem I described. My code looks like this:
main.scss:
@use "lib" as *;
//@use "lib"
Now, when I save lib.scss, the comment triggers the compilation of main.scss
from webcompiler.
Sorry, I think I misread your comment, I read it as the compilation wasn’t working correctly when using the other variations of @use; I’ll look i to why it’s not correctly parsing the file url out of the complex matches. Thanks for the clarification!
from webcompiler.
I’m not good enough with Regex to make the pattern match better, but I could split the string on “as” and “with” in the GetFileInfos function to get it working.
from webcompiler.
I'm no expert either, but may I offer a suggestion:
According to the docs, the syntax of @use & @forward is simpler than @import, specifically in that it only allows one file per rule.
Maybe you could process them separately?
This regex should work (capture what's in between the quotes following the at-rule):
(?<=^@use|^@forward)\s+(["'])(?<url>.+?[^\\])\1
This would allow restoring the original version of line 53 to process the @import rules.
from webcompiler.
@failwyn I modified the code and managed to create a working version (tested in VS 2022).
It looks like I'm missing some dependencies and tools on my machine to actually build the vsix, so I can't test the compiled extension itself.
Should I create a pull request?
from webcompiler.
If you want to check it in, I’ll take a look at it; I got it working with the string split, but if your fix is better, I’d be happy to implement it.
from webcompiler.
Done.
Note that also the original processing of @import rules wasn't complete - it also didn't cover cases where the rule contained optional clauses that are part of the syntax.
But since nobody has complained until today, and Sass is now deprecating @import, there's probably no point in fixing it.
from webcompiler.
I'm testing a fix for this that makes fewer changes and appears to work in all scenarios that I could think of without modifying too much code. I committed the change in a branch if anyone wants to review it before I merge it to release a new version.
from webcompiler.
Thank you for taking the time to rewrite the code and create the Pull Request, I really appreciate the help and input even if we didn’t use it this time. If I had the time to test it thoroughly I would have merged it. Thanks for validating this fix as well!
from webcompiler.
Related Issues (20)
- Feature - Web Compiler for Folder View
- SCSS Not Generating Map Files HOT 4
- BuildWebCompiler2022 dotnet6 supported? HOT 1
- Javascript files not automatically being recompiled on save HOT 6
- :has(...) selector not minifying correctly HOT 1
- SCSS compiler do not exclude CSS style Comments HOT 6
- JSX Optional Chaining results in Unexpected Token error on compilation HOT 2
- Build error when upgrading to 1.14.9 HOT 2
- Exception when running the tasks HOT 5
- v1.14.9 doesn't work in VS versions earlier than 17.4 HOT 3
- The 'WebCompilerInitPackage" package did not load correctly. HOT 8
- Js Complier (1.14.9.2 ) not working in lastest Visual Studio(17.4.2)! HOT 21
- Version 14.9.2 changes "0 none" to "0 0" during minification HOT 9
- Files appear to have changes, although no visible changes are seen + Compile on save. HOT 10
- Relative Path for Imported SCSS not Compiling to Proper Path HOT 3
- cant work in linux HOT 3
- "math" option in compilerconfig defaults not working HOT 12
- Problem with compiling HOT 18
- VS Gallery link pointing at old version HOT 2
- Context menus not displaying HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webcompiler.