failwyn / webcompiler Goto Github PK
View Code? Open in Web Editor NEWThis project forked from madskristensen/webcompiler
Visual Studio extension for compiling LESS and Sass files
License: Other
This project forked from madskristensen/webcompiler
Visual Studio extension for compiling LESS and Sass files
License: Other
Include auto compile for .js files.
At the moment, i must explicity say "Re-compile file" or save the compilerconfig.json file, to compile javascript files.
When i save a javascript file, that the file will be compiled.
Recompiling Sass after editing a file doesn't work
files do not change
compiled files must contain new code
I use a translator. sorry if something is not clear
Can't compile stylesheets when i try to import a scss file from the node_modules folder. In VS 2019 the setting "includePath: 'node_modules'" did the trick. In VS 2022 not anymore
Not compiling, gives the error:
Error: Can't find stylesheet to import. @import "@progress/kendo-theme-bootstrap/dist/all.scss"; wwwroot\css\base.scss 45:9 root stylesheet
Compiling the file with node module files.
Microsoft Visual Studio Community 2022 Preview (64-bit)
Version 17.0.0 Preview 3.1
Web Compiler 1.13.2
Right click on "compilerconfig.json" -> Web compiler -> Enable compile on build... asks me to install NuGet package, clicking "Yes" and than got the error below. On VS2019 this feature works.
The dollar variables are no more replaced anywhere in a .scss file, breaking up everything in the pipeline.
(I'm using the NuGet package, at compilation time the WebCompiler is triggered.)
variables.scss
:$main-pc: hsl(25,84,88); //#fbe9d7;
:root {
--background: $main-pc;
}
@import
of variables.scss
:[
{
"outputFile": "wwwroot/css/my-style.css",
"inputFile": "SCSS/main.scss"
}
]
my-style.css
output to find this::root {
--background: $main-pc;
}
It doesn't apply the dollar variables.
It should apply the dollars variable value.
With version 1.14.6 all works fine. (Even after downgrading from 1.14.7 to 1.14.6 again.)
After updating to 1.14.7 I get the following as part of the docker log:
Output of Docker Log
#18 9.386 WebCompiler: Begin compiling compilerconfig.json
#18 9.502 WebCompiler installing updated versions of the compilers...
#18 9.523 /root/.nuget/packages/buildwebcompiler2022/1.14.7/build/BuildWebCompiler2022.targets(12,9): error : An error occurred trying to start process 'cmd.exe' with working directory '/tmp/WebCompiler1.14.7'. No such file or directory [/src/Wxxx/Identity/Server/Wxxx.Identity.Provider/Wxxx.Identity.Provider.csproj]
#18 9.533
#18 9.533 Build FAILED.
The build fails with error message above
Build succeeds like with 1.14.6
I'm using AdminLte as my base for styling.
I added a scss file in my project and the first line is:
@use '../../wwwroot/AdminLte/dist/css/adminlte.css';
When I compile I get the error:
Error: 0.25rem and 0 are incompatible.
?
4884 � border-top-left-radius: calc(0.25rem - 0);
� ^^^^^^^^^^^
For example in the following code:
.card-img,
.card-img-bottom {
border-bottom-right-radius: calc(0.25rem - 0);
border-bottom-left-radius: calc(0.25rem - 0);
}
Apart from removing - 0
(which I'd rather would not like to do), how can I solve this problem?
The extension is unable to compile sass files, probably because of an outdated node package caniuse-lite
or browserslist
.
compilerconfig.json
file and choose WebCompiler > Re-compile all filesWhen trying to compile a scss file, an error pops up in the Error List pane of Visual Studio:
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
Executing the given command in Windows Terminal / Powershell tells me it cannot find package.json
.
The installation path of the extensions at C:\Users\USERNAME\AppData\Local\Temp\WebCompiler1.14.7
does indeed not contain a package.json
.
I don't use node and/or npm manually (and that's why I use this extension). I have no clue on how to update browserslist
or caniuse-lite
for this extension.
Compile the sass files succesfully :)
Dart-Sass ignores the "indentWidth" default setting for sass. When it is set to 4, the output still put 2 spaces.
Outputted CSS has an indentation of 2 spaces.
Outputted css should have an indentation of 4 spaces according to the default setting.
Compiling site.less
fails on access to the path 7z.dll
Fails on unhandled exception
C:\... repo> C:\USERS\... path to VS\WebCompiler.exe "C:/.../compilerconfig.json" "wwwroot/css/site.less"
Unhandled Exception: System.UnauthorizedAccessException: Access to the path '7z.dll' is denied.
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
at WebCompiler.CompilerService.Initialize() in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Compile\CompilerService.cs:line 93
at WebCompiler.CompilerService.GetCompiler(Config config) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Compile\CompilerService.cs:line 37
at WebCompiler.ConfigFileProcessor.ProcessConfig(String baseFolder, Config config) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Config\ConfigFileProcessor.cs:line 190
at WebCompiler.ConfigFileProcessor.Process(String configFile, IEnumerable`1 configs, Boolean force) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Config\ConfigFileProcessor.cs:line 44
at WebCompiler.Program.Main(String[] args) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Program.cs:line 25
Process terminated with code -532462766.
The file should be compiled/bundled with no exception or at least with meaningful information why is it trying to delete the 7z.dll
.
Invalid error - can't compile the project!
I have the following valid SCSS in one of my SCSS files:
.cities-columns {
list-style-type: none;
display: grid;
// ===> Error is thrown because of THIS line
grid-template-columns: repeat(auto-fit,minmax(min(15em, 100%), 1fr));
padding-left: 0;
li {
padding: .2em;
}
}
Throws the following error:
Severity Code Description Project File Line Suppression State
Error 0 cannot compare numbers with incompatible units
...\scss\theme.scss
And the Error List point to the wrong file, wrong line and even wrong position within that line (points to middle of nowhere). So it was really hard to find.
Shouldn't throw, it's perfectly valid CSS.
Babel errors on compiling (minifying) js files. I have a VS2019 installation on the same machine, which works just fine (with Mads' extension)
It doesn't compile, instead give me an error: (copy)
Severity Code Description Project File Line Suppression State
Error Error: Couldn't find preset "react" relative to directory "C:/website/js"
at C:\Users\el_st\AppData\Local\Temp\WebCompiler1.12.6\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19
at Array.map ()
at OptionManager.resolvePresets (C:\Users\el_st\AppData\Local\Temp\WebCompiler1.12.6\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
at OptionManager.mergePresets (C:\Users\el_st\AppData\Local\Temp\WebCompiler1.12.6\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
at OptionManager.mergeOptions (C:\Users\el_st\AppData\Local\Temp\WebCompiler1.12.6\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
at OptionManager.init (C:\Users\el_st\AppData\Local\Temp\WebCompiler1.12.6\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (C:\Users\el_st\AppData\Local\Temp\WebCompiler1.12.6\node_modules\babel-core\lib\transformation\file\index.js:212:65)
at new File (C:\Users\el_st\AppData\Local\Temp\WebCompiler1.12.6\node_modules\babel-core\lib\transformation\file\index.js:135:24)
at Pipeline.transform (C:\Users\el_st\AppData\Local\Temp\WebCompiler1.12.6\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
at transform (C:\Users\el_st\AppData\Local\Temp\WebCompiler1.12.6\node_modules\babel-cli\lib\babel\util.js:50:22)
MyProject C:\website\js\any.js 0
Should compile correctly
Compilation fails when a custom CSS properties uses a variable.
The "variable name" rather than the "value" gets compiled into the CSS file.
The CSS should display:
.my-class {
--mdc-theme-primary: #4caf50;
}
But instead displays:
.my-class {
--mdc-theme-primary: $medium-green;
}
When interpolating SCSS variables, unexpected outcomes seem to be occurring. I'm relatively new to this particular part of SCSS, so it might just be me getting it wrong.
I've created a mixin:
@mixin theme() {
@each $theme, $map in $themes {
@if $theme == "default" {
:root {
@each $key, $value in $map {
#{--#{$key}}: $value;
}
}
}
@else {
[data-theme="#{$theme}" ] {
@each $key, $value in $map {
#{--#{$key}}: $value;
}
}
}
}
}
Based upon this map:
$themes: (
default:(
Franklin-Blue: #1d1c4d,
Light-Blue: #4e5d94,
Pale-Blue: #7289da,
Pure-White: #ffffff,
VLight-Grey: #99aab5,
Middle-Grey: #2c2f33,
Dark-Grey: #23272a,
body-color: #ffffff,
text-color: #000000,
bold-text: #000000,
White-Blue: #ffffff
),
dark: (
Franklin-Blue: #000000,
Light-Blue: #0d0d0d,
Pale-Blue: #2c2f33,
Pure-White: #ffffff,
VLight-Grey: #99aab5,
Middle-Grey: #2c2f33,
Dark-Grey: #23272a,
body-color: #000000,
text-color: #ffffff,
bold-text: #7289da,
White-Blue: #7289da
)
);
Which results in this:
:root {
--Franklin-Blue: #1d1c4d;
--Light-Blue: #4e5d94;
--Pale-Blue: #7289da;
--Pure-White: #ffffff;
--VLight-Grey: #99aab5;
--Middle-Grey: #2c2f33;
--Dark-Grey: #23272a;
--body-color: #ffffff;
--text-color: #000000;
--bold-text: #000000;
--White-Blue: #ffffff;
}
[data-theme=dark] {
--Franklin-Blue: #000000;
--Light-Blue: #0d0d0d;
--Pale-Blue: #2c2f33;
--Pure-White: #ffffff;
--VLight-Grey: #99aab5;
--Middle-Grey: #2c2f33;
--Dark-Grey: #23272a;
--body-color: #000000;
--text-color: #ffffff;
--bold-text: #7289da;
--White-Blue: #7289da;
}
Now, in my attempts to get quotes around that theme (i.e. [data-theme="dark"]
), I've had [data-theme=\"dark\"]
, [data-theme="'dark'"]
, [data-theme='"dark"']
and just about every other combination - but it just seems not to work.
Is it just me, or have I found an actual issue?
Hello,
Can you output new releases to the release feed?
That way it can be monitored with RSS :)
PS: thank you for taking up the support!!
Sc0tTy
I'm using Web Compiler 2022+ within VS 2022.
Currently, I can only set the option "useNodeSass": true within compilerconfig.json for each input/output pair. I would like to set this globally within compilerconfig.json.defaults, but it doesn't seem like it's supported. Or if it is, I must not be getting the syntax correct.
Could we add the NodeSass option within the defaults?
AFAICT: Was working in 1.14.4
When Web Compiling a scss file the compilation succeeds but the resultant css file contains:
"0" is not an allowed value for option "style".
Usage: sass <input.scss> [output.css]
sass <input.scss>:<output.css> <input/>:<output/> <dir/>
=== Input and Output ===================
--[no-]stdin Read the stylesheet from stdin.
--[no-]indented Use the indented syntax for input from stdin.
-I, --load-path=<PATH> A path to use when resolving imports.
May be passed multiple times.
-s, --style=<NAME> Output style.
[expanded (default), compressed]
--[no-]charset Emit a @charset or BOM for CSS with non-ASCII characters.
(defaults to on)
--[no-]error-css When an error occurs, emit a stylesheet describing it.
Defaults to true when compiling to a file.
--update Only compile out-of-date stylesheets.
=== Source Maps ========================
--[no-]source-map Whether to generate source maps.
(defaults to on)
--source-map-urls How to link from source maps to source files.
[relative (default), absolute]
--[no-]embed-sources Embed source file contents in source maps.
--[no-]embed-source-map Embed source map contents in CSS.
=== Other ==============================
-w, --watch Watch stylesheets and recompile when they change.
--[no-]poll Manually check for changes rather than using a native watcher.
Only valid with --watch.
--[no-]stop-on-error Don't compile more files once an error is encountered.
-i, --interactive Run an interactive SassScript shell.
-c, --[no-]color Whether to use terminal colors for messages.
--[no-]unicode Whether to use Unicode characters for messages.
-q, --[no-]quiet Don't print warnings.
--[no-]quiet-deps Don't print compiler warnings from dependencies.
Stylesheets imported through load paths count as dependencies.
--[no-]verbose Print all deprecation warnings even when they're repetitive.
--[no-]trace Print full Dart stack traces for exceptions.
-h, --help Print this usage information.
--version Print the version of Dart Sass.
Can't call mixin from another scss file by using @use statement.
@mixin box($width, $height: $width) {
width: $width;
height: $height;
}
Call the mixin from another scss file, let's name it style.scss:
@use "base";
a {
@include box(50px);
}
Severity Code Description Project File Line Suppression State
Error Error: Undefined mixin.
╷
13 │ @include box(50px);
│ ^^^^^^^^^^^^^^^^^^
╵
wwwroot\css\style.scss 13:9 root stylesheet
...\wwwroot\css\style.scss 0
This is supported by @import statement, but doesn't work with @use.
Since @import is going to be deprecated and @use should be used, then this needs to be supported by web compiler as well.
Extension don't start in ARM64 of Visual Studio
in log :
CreateInstance failed for package [WebCompilerInitPackage]Source: 'mscorlib' Description: Could not load file or assembly 'file:///c:\users\pynux\appdata\local\microsoft\visualstudio\17.0_b2995c49\extensions\oucyl340.vrz\WebCompilerVsix.dll' or one of its dependencies. Tentative de chargement d’un programme de format incorrect.
System.BadImageFormatException: Could not load file or assembly 'file:///c:\users\pynux\appdata\local\microsoft\visualstudio\17.0_b2995c49\extensions\oucyl340.vrz\WebCompilerVsix.dll' or one of its dependencies. Tentative de chargement d’un programme de format incorrect.
File name: 'file:///c:\users\pynux\appdata\local\microsoft\visualstudio\17.0_b2995c49\extensions\oucyl340.vrz\WebCompilerVsix.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)
at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
1.Install pextensions
2. Restart Visual Studio
3. Extension don't start missing
When i try to run the extension via Task Runner the process fails if the files to write already exists from a previous run. If I manually remove the files the extension works without a problem.
C:\dev\git\[projectname]\src\app\[appname]> c:\users\[username]\appdata\local\microsoft\visualstudio\17.0_ce87f30b\extensions\m5tn5y43.4ri\WebCompiler.exe "C:/dev/git/[projectname]/src/app/[appname]/compilerconfig.json" "Sass/Core/core.main.scss"
Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2)
at WebCompiler.SassDependencyResolver.UpdateFileDependencies(String path) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Dependencies\SassDependencyResolver.cs:line 71
at WebCompiler.DependencyResolverBase.GetDependencies(String projectRootPath) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Dependencies\DependencyResolverBase.cs:line 57
at WebCompiler.Config.HasDependenciesNewerThanOutput(FileInfo input, FileInfo output) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Config\Config.cs:line 102
at WebCompiler.Config.CompilationRequired() in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Config\Config.cs:line 95
at WebCompiler.ConfigFileProcessor.Process(String configFile, IEnumerable1 configs, Boolean force) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Config\ConfigFileProcessor.cs:line 42
at WebCompiler.Program.Main(String[] args) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Program.cs:line 25
Process terminated with code -532462766.
{
"outputFile": "Sass/Core/compiled/core.main.css",
"inputFile": "Sass/Core/core.main.scss",
"options": {
"sourceMap": true,
"sourceMapRoot": "/"
}
}
The "Web Compiler" menu does not show up on right click of any file, including compilerconfig.json
Not menu showing
Expecting menu like this image:
https://github.com/failwyn/WebCompiler/blob/master/art/contextmenu-compile.png
A compilerconfig.json option for using "use strict" in javascript minification is highly wanted. It has been asked in Mads' version multiple times, but never created. Now the compiled version of a javascript file always has the "use strict" statement whenever we use Webcompiler, Re-compile file. It also recompiles all files when you add a new js to the compilerconfig and thus add the "use strict" again.
Re-compiled minified javascript files get the "use strict" statement by default. This is unwanted, because if one would like to use strict, one should enable that in unminified javascript or have an option to enable it. In which case the minifier should use it too. There's no option to switch off this behavior in compilerconfig.
Have an option in compilerconfig.json. enabled by default. When set to disabled and no statement in unminified version, the minified version shouldn't have it too. Only when enabled by default or explicitly set, we should get "use strict" in the minified javascript file.
Dart sass appears to have an option for line feed. Please allow the option for it in the compilerconfig.json
Hello,
Can you tell us (and possibly update the documentation) what version of the Dart Sass compiler you are using?
And can you tell us if you are using the JS or VM version ?
https://itnext.io/the-css-preprocessor-dilemma-node-sass-or-dart-sass-32a0a096572
Thank you!
Sc0tTy
When I have a less files in another location and "add an item as link", Webcompiler cannot find file
(P1) ASP.NET Core 6.0 Project (Microsoft.NET.Sdk.Web)
(P2) Class Library (Microsoft.NET.Sdk.Razor)
Create a "colors.less" file in P2
Create a "site.less" file in P1
In P1, add existing file and select the ""colors.less" from P2 and in the dropdown, "Add As Link"
Add @import "Colors.less"; to "site.less"
(Re)Compile "site.less"
FileError: 'colors.less' wasn't found.
Should compile "site.less"
css.zip
One of my .scss files does not automatically recompile while the others do. My folder contains four .scss files:
bootstrap.css/bootstrap.min.css and and site.css/site.min.css are automatically generated, but kendo.css/kendo.min.css are not.
This is the contents of kendo.scss:
@import "../css/_variables.scss";
$kendo-picker-hover-bg: #fff;
@import "../lib/kendo-theme-bootstrap/dist/all";
Trying to build the solution fails with a strange error:
WebCompiler error 0: Invalid CSS after "...-header-border,": expected expression (e.g. 1px, bold), was ");"
The build succeeds without error if kendo.css already exists, even if it's an empty file. However, the build does not generate kendo.css/kendo.min.css.
If I right-click on kendo.scss and choose Web Compiler > Re-compile file or right-click on compilerconfig.json and choose Web Compiler > Re-compile all files, kendo.css/kendo.min.css are correctly generated without issue. Or if I make a change to kendo.scss and save, it gets recompiled automatically. But it's not being compiled on build like the other .scss files are. Here's the contents of compilerconfig.json:
[
{
"outputFile": "wwwroot/css/bootstrap.css",
"inputFile": "wwwroot/css/bootstrap.scss"
},
{
"outputFile": "wwwroot/css/kendo.css",
"inputFile": "wwwroot/css/kendo.scss"
},
{
"outputFile": "wwwroot/css/site.css",
"inputFile": "wwwroot/css/site.scss"
},
{
"outputFile": "Shared/TopNav.razor.css",
"inputFile": "Shared/TopNav.razor.scss"
}
]
kendo.scss is only recompiled when triggered manually.
kendo.scss is automatically recompiled and compiled on build like the other .scss files in the folder.
Since I upgrade VS 2022 from 17.0.2 to 17.0.5, less compilation does not work anymore. I get a message:
"This application cannot run on your PC"
Or
I tried to start VS as administrator and the result is the same.
I also tried to uninstall/reinstall the extension
Just installed VS 2022 (released 2 hours ago) on a fresh windows installation and Installed the WebCompiler 2022 extension.
I get an error during compilation:
SomeFile.less : WebCompiler error 0: The --ie-compat option is deprecated, as it has no effect on compilation.
I know that you wrote that you fixed exactly this issue for the release, so this is a bit unexpected.
Error message, see description
The *.less files (and other files) should compile without error.
Incorrect/different SCSS output
Using this scss:
%tb {
border: solid 1px #666;
&:focus {
border-color: #000;
}
}
@each $type in text, search, email, number, tel, time, password {
input[type=#{$type}] {
@extend %tb;
}
}
It's producing output:
input[type=text], input[type=search], input[type=email], input[type=number], input[type=tel], input[type=time], input[type=password], input[type^=date] {
border: solid 1px #666;
}
input:focus[type=text], input:focus[type=search], input:focus[type=email], input:focus[type=number], input:focus[type=tel], input:focus[type=time], input:focus[type=password], input:focus[type^=date] {
border-color: #000; }
The :focus pseudo class should be after the attribute specifier. It was this way in the VS2019 extension.
input[type=text], input[type=search], input[type=email], input[type=number], input[type=tel], input[type=time], input[type=password], input[type^=date] {
border: solid 1px #666;
}
input[type=text]:focus, input[type=search]:focus, input[type=email]:focus, input[type=number]:focus, input[type=tel]:focus, input[type=time]:focus, input[type=password]:focus, input[type^=date]:focus {
border-color: #000; }
This could be related to the Dart vs Node issue - I'm not sure what the differences are.
Didn't test that but from code analysis looks like there is bug in file: LessCompiler.cs
if (options.IECompat)
arguments += " --ie-compat";
if (options.StrictUnits)
arguments += " --strict-units=on";
was changed to:
if (options.IECompat)
//arguments += " --ie-compat";
if (options.StrictUnits)
arguments += " --strict-units=on";
which translates to:
if (options.IECompat)
{
if (options.StrictUnits)
arguments += " --strict-units=on";
}
so line:
if (options.IECompat)
should also be commented out
Btw: Thanks for your effort to port this project to VS2022
I tried to open your project in VS 2019 but it did not work: it builds ok, but the extension doesn't install correctly.
Then I tried opening in VS 2015 but it also did not work, because the targeted SDK was too new.
I determined that the best version to open and edit the project is VS 2017, so I tried opening it in VS 2017, but it doesn't work as I get these two errors:
The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets
The current .NET SDK does not support targeting .NET Standard 2.1. Either target .NET Standard 1.6 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. WebCompiler C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets
What am I doing wrong? Can you provide the correct steps to correctly open and edit your fork?
I cannot build the project, even after opening it with visual studio 2015, 2017, 2019.
The solution should open and build fine in VS 2017, and by building the WebCompilerVsix project I should be able to create and install the extension file without any problem.
Output of the compiled javascript file, that contains an exported function, does not work.
export function testFunction() { }
Compile a javascript file and let the browser load the file. Browser gives an error 'Uncaught ReferenceError: exports is not defined'.
Compiled file, contains statements, that aren't necessary for javascript files.
The output of the compiled file is this:
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.testFunction = testFunction;
function testFunction() {}
Object.defineProperty()
and exports.testFunction
are too much.
Or can i change/set properties, to "modify" the output, like the type of the compilation process as example es6 or es5.
I searched for those properties, but i dont found something.
This extension would be far better if I didn't have to worry about other developers (or myself) forgetting to add new JSX files to the compilerconfig.json file.
Assuming there is main.scss file, which imports a _variables.scss file by using @use.
Now the _variables.scss file is changed and saved. The expected behaviour would be that the main.scss file is recompiled, however that is not the case. This scenario works when we use @import
instead of @use
to import the variables.scss file: the main.scss file is recompiled when there are changes in the _variables.scss saved.
$my-color: blue;
@use "variables"
.testclass {
color: variables.$my-color;
}
$my-color: black;
color
is still set to blueA scss file importing another scss file using @use
is not recompiled when the imported file is changed.
A scss file which imports another scss file using @use
should be recompiled when the imported file changes.
I have SASS file with variables injected as CSS 4 variables values, and they're not replaced by the compilation.
$test: 1.5rem;
$test2: 2rem;
:root {
--my-var: $test;
}
.myClass {
--my-var: $test2;
}
Generated CSS from this extension:
:root {
--my-var: $test;
}
.myClass {
--my-var: $test2;
}
Generated CSS from the original extension (VS 2019):
:root {
--my-var: 1.5rem; }
.myClass {
--my-var: 2rem; }
Visual Studio: Microsoft Visual Studio Professional 2022 (2) (64-bit) - Current Version 17.2.1
This extension: 1.14.7
Will not compile after installing VS 2022 pro. No issues when using Community version (now uninstalled) or when using sass compiler in vs code.
Refuses to compile
Compiles Sass without throwing an error
SASS compilation is including references to SASS variables in css output when using mixins that assign css variables
@mixin myThemeMixin ($primary, $secondary) {
:root {
--my-css-variable: $primary;
--my-second-variable: darken($secondary, 5%);
}
}
@include myThemeMixin(#181818, #323232);
The compiled file contains the SASS variables names instead of the passed variable values
:root {
--my-css-variable: $primary;
--my-second-variable: darken($secondary, 5%);
}
The compiled stylesheets should not contain any references to SASS variables
After upgrading from the previous of WebCompiler,
We have a scss file with an @import path like this:
@import "../../../../../lib/bootstrap/scss/bootstrap.scss";
I had to edit all of them to include an additional ../
@import "../../../../../../lib/bootstrap/scss/bootstrap.scss";
Also I had to manually uninstall the old WebCompiler nuget package and it would be nice if this one automatically removed what is now a duplicate package and targets.
Thank you very much for getting this updated to 2022!
Node-sass is deprecated, we should use Dart-sass
https://itnext.io/the-css-preprocessor-dilemma-node-sass-or-dart-sass-32a0a096572
A deprecated SASS compiler is used.
None deprecated version of SASS compiler should be used.
Version 17.0.0 Preview 3.1
VisualStudio.17.Preview/17.0.0-pre.3.1+31612.314
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Enterprise
Web Compiler 1.13.002
Compiler for LESS, Sass and CoffeeScript files
VSIX does not install Json library.
Using Task Runner, produces the following error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
at WebCompiler.ConfigHandler.GetConfigs(String fileName)
at WebCompiler.Program.GetConfigs(String configPath, String file) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Program.cs:line 55
at WebCompiler.Program.Main(String[] args) in W:\Git\Light Speed Solutions\WebCompiler\src\WebCompiler\Program.cs:line 14
Adding this library directly to vsix install path resolves error - download
SCSS values are not compiled in css variables
$scss-color-value: #ffffff
--css-variable: $scss-color-value;
//After Rendering
--css-variable: $scss-color-value;
$scss-color-value: #ffffff
--css-variable: $scss-color-value;
//After Rendering
--css-variable: #ffffff;
map-get commands in scss files are not being replaced with values for css variables.
#test {
--mainBackground: map-get($colors, 'red');
background: map-get($colors, 'red');
}
When compiled, the background value will be correctly replaced with the red from the $colors array, but the --mainBackground variable does not:
#test {
--mainBackground: map-get($colors, 'red');
background: #FF0000;
}
The css variable should also have the value replaced.
When compiling SCSS files the CSS file is not generated and this error occurs...
"Unexpected character encountered while parsing value: [. Path 'loadPaths', line 3, position 16"
This error started after upgrading VS to 17.1.1 from previous latest version.
Same error happens in another solution that was also working fine before the VS upgrade.
Any help appreciated!
Hi,
I'm currently using something like this to compile Handlebars templates:
call node node_modules\handlebars\bin\handlebars Static\Templates -f Static\Templates\templates.js
.
It takes all templates in the directory and compiles them to a single script.
Can this be achieved with WebCompiler? It seems to me that it is not because only a single input file (with extension) can be specified but I wanted to check to be sure.
Thanks a lot!
Bootstrap SASS compiled with get-function inside CSS
"get-function" is in the CSS content
"get-function" should not be in the CSS
Less didn't compile properly on operations with parentheses.
width: (100px - 50px)/2;
The result in css file is width: 50px/2;
The result in css should be width: 25px;
Any attempt to compile a SCSS file generates an error message ("The system cannot find the path specified."). The error list message identifies the location of the error as the file to be compiled, at line 0.
Rolled a fresh .NET Framework 4.8 MVC project, which compiles and runs fine.
Added a test.scss file in the Content folder. It contains a single rule: a { text-decoration: underline; }.
Right-click on test.scss and select "Web Compiler/Re-compile file". The compilerconfig.json and compilerconfig.json.defaults files are generated by the web compiler. The compilerconfig.json appears to be correct:
[
{
"outputFile": "Content/test.css",
"inputFile": "Content/test.scss"
}
]
The error noted above is generated on the Error List, and no test.css is created.
Generate the css file from the scss file. This works fine in VS 2019.
Edit: Have quite a few extensions installed. Tried disabling all others. No change to the behavior.
Edit: When I created the solution using the VS template, I did not select the option to put the solution and project in same folder.
The extension is working great for development, but the nuget package that is used for enabling compilation on build systems outside of visual studio is not updated. Hence the build fails when any new features of autoprefixer are used.
Build fails with the following error,
WebCompiler error 0: Browserslist: caniuse-lite is outdated. Please run next command npm update
Scss files should get compiled and build successfully with autoPrefix: ">= 0.5%, last 2 major versions, not dead, Chrome >= 60, Firefox >= 60, Firefox ESR, iOS >= 12, Safari >= 12, not Explorer <= 11".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.