-->

Can Web Essentials be configured to NOT add *.css

2020-08-10 07:34发布

问题:

We are using Visual Studio + Web Essentials to compile LESS files to CSS. Whenever we change a LESS file Web Essentials insists on creating a *.css, *.min.css and a *.css.map file AND add them to the Visual Studio project file.

We don't want to check-in these files to Source Control the same as we don't check-in dll files.

So my question is: Can we configure Web Essentials to NOT add *.css & *.css.map to VS project?

回答1:

No. Web Essentials will add the generated CSS files to the VS Project.

You can use dotless to generate CSS files on build without adding them to the VS project.



回答2:

You can now, just add "includeInProject": false to the compilerconfig.json file

{
    "outputFile": "Assets/css/themes/Default.css",
    "inputFile": "Assets/css/themes/Default.scss",
    "includeInProject": false
  },


回答3:

Go to [Tools-> Options-> Web Essentials -> LESS] and set false: "Auto-compile dependent files on save", "Compile files on save" and "Create source map file"



回答4:

You could configure a .gitignore rule so they don't get committed, but that would also mean they wouldn't get updated as changes were made to the .less files by other people or when switching branches until you triggered a recompile of the .less files.



回答5:

Ensure all files in project saved in + bundle files have runOnBuild=true.

Delete all web essentials generated files.

Go to checkin & undo changes to just the project file.

Checkin the deletions, so excess files are removed from tfs.

That worked for me on VS2013. Clean get of project regenerates them on build but doesn't try to re-add to TFS. Deploy project includes the W.E files as they are still referenced by the project.