Can't compile attachments with web compiler 2015

Ok, I was very surprised when installing Web Essentials 2015 for Visual Studio 2015, in which it no longer included the compiler: "Web Essentials 2015 no longer contains functions for linking and minifying JS, CSS and HTML files, and for compiling LESS."

Everything worked fine with Visual Studio 2013. So I downloaded Web Compiler 2015 as this is the new compiler from Mads Kristensen. But by adding all the necessary compilation files to compilerconfig.json, I have a compilation error that it no longer recognizes my variables and my mixins!

Here's my .less site:

/* Colors and common variables */
@import "Colors";
@import "Variables";

/* Reseting default values for all internet browsers */
@import "Reset.css";

/*  BootStrap   */
@import "../../../Content/bootstrap/bootstrap.less";

/* Basic mixins */
@import "mixins/Generic_Mixin.less";
@import "mixins/Controls.less";
@import "mixins/Images.less";
@import "mixins/Navigation.less";
@import "mixins/Text.less";

/* Website specific classes */
@import "Controls.less";
@import "Footer.less";
@import "Header.less";
@import "Images.less";
@import "Text.less";
@import "combobox.less";

@import "Sitemaster.less";

      

And here is one of my many mistakes:

variable @font-size-base is undefined on line 49 in file
'C:\Users\(...)\Site.WebApp\App_Themes\Default\Styles\mixins\Variables.less':

      

Please I don't understand anything for all this, does anyone have an answer for me? thank.

+3


source to share


1 answer


I had the same problem. The web compiler failed in many ways and the workarounds were messy and wouldn't be easy to maintain. Future versions of the Web Compiler may be helpful, but I've come to the conclusion that it's worth just switching to a more mature compilation tool.

This is what worked for me: Disable web compiler Tools-> Extensions and Updates-> Installed (search for web compiler) -> Disable

Next, set up Grunt.js by following one of the many tutorials. I used this Scott Hanselman: http://www.hanselman.com/blog/IntroducingGulpGruntBowerAndNpmSupportForVisualStudio.aspx

Here's another reference that I found very useful: https://www.orderfactory.com/articles/Bootstrap-LESS-Grunt-VS.html

Since it looks like you were basically where I was before I followed these instructions, you might run into a different issue with compiling TypeScript, which was included by default in the Web Compiler.



If you are getting a bunch of "duplicate id" errors related to lib.core.d.ts, you may need to disable automatic TypeScript compilation: right click on Project-> Properties -> TypeScript Build-> uncheck "Compile on save"

Installing the web compiler and setting up the node tools and assigning an automated task can lead to deploying the ts compiler to run through all node_modules looking for things to compile. It could be a mess.

If you want to leave TypeScript compilation on build, you need to add a tsconfig.json file to the root of your project to define specific file paths. Without this file, the compiler looks all over the place and you really don't want it. It was easier for me to just turn it off.

See here for more details: Typescript confusing "duplicate id" error message

Hope it helps.

+5


source







All Articles