How to create new compilerconfig.json Web compiler (Extension)?

16,110

All you need to do after adding a new .less file to your project is right click the new .less file and "Compile File" should be the only option, by selecting that option it will then be added to the compilerconfig.json file. This will not add all the .less files in the project to the config, with a single click, but it will automatically add them with a quick click on each file, and you wont have to be adding them manually.

BEFORE:

[
  {
    "outputFile": "less/site.css",
    "inputFile": "less/site.less"
  }
]

AFTER:

[
  {
    "outputFile": "less/site.css",
    "inputFile": "less/site.less"
  },
  {
    "outputFile": "less/theme.css",
    "inputFile": "less/theme.less"
  }
]

You can also recompile all the files from the Task Runner Explorer window (View -> Other Windows -> Task Runner Explorer). There you should see the compilerconfig.json, below that you will see "LESS", you can "Run" that to compile all, or a select a single file. You can also compile on build.

An alternative method would be to use a gulp file. You can set up a task to get all the less files in your project, without another thought to it after setting it up.

Share:
16,110
Admin
Author by

Admin

Updated on July 20, 2022

Comments

  • Admin
    Admin almost 2 years

    I have project with a lot of less files, I'm used in Web compiler (developer Mads Kristensen) Extension for visual studio 2015.

    my way to create compilerconfig.json is to compile single file and then edit manually the file, to work with all the other less files in the project. I'm sure it's wrong way...

    I don't understand, how I can to create new compilerconfig.json file that include all the less files in existing project?

    because in this situation when I added new less file the only way to add file is go to compilerconfig.json and add it manually.

    we don't have option to create new compilerconfig.json with all the less files in automatically way?

    Less Web Compiler

  • Bluesight
    Bluesight about 4 years
    Still works for older MVC Projects in Visual Studio 2019. This should be the accepted answer
  • Jimbo
    Jimbo almost 4 years
    Task Runner Explorer showed me that there was an error in my .less files which werent being output during build. Very useful, thanks.
  • klewis
    klewis about 3 years
    This doesn't answer the question. How can we add one parent file into the compiler config file, that is already referencing multiple scss files into itself?