15

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?

Thomas Jespersen
  • 11,493
  • 14
  • 47
  • 55
  • 1
    More info: We tried to just ignore the files in .gitignore but then our build server fails, because MS Web Deploy fails unless all files in the project exists. We have a build event that creates one main.css by including all LESS files into main.less and then creates main.css. – Thomas Jespersen Jul 23 '14 at 13:29
  • 1
    So do you need these css files at all? As you could stop Web Essentials creating them and then use your build task to create the file. – Colin Bacon Jul 23 '14 at 13:33
  • 1
    Good question. I need the main.css when developing... but not all the other files. I don't care if they are created... but I just don't want them include in my VS project. – Thomas Jespersen Jul 23 '14 at 14:29

5 Answers5

6

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
  },
user973671
  • 1,620
  • 6
  • 27
  • 39
4

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.

Jerry Joseph
  • 1,002
  • 8
  • 14
  • 1
    That is actually what we ended up doing ;-) – Thomas Jespersen Sep 07 '14 at 08:02
  • So is this your setup? 1. Git ignore all css, min, and map files under /certain-path/. 2. Add a post-build event to have dotless generate css (+ min + map, if desired). Anything else? – Sean Apr 08 '16 at 23:55
  • @Sean Yes that's it. Instead of post-build event in Visual Studio I modify the section of the csproj file so that MSBuild will handle it even when building without Visual Studio. – Jerry Joseph Apr 09 '16 at 10:35
1

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"

Jorgelig
  • 184
  • 2
  • 9
0

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.

thelem
  • 2,642
  • 1
  • 24
  • 34
  • 2
    The problem with doing this is the ```.css.map``` file will still be part of the project file, and you can come into problems when publishing with Web Deploy from a build server, as the project thinks there should be the ```.css.map``` files are there. Since the files aren't there, the deploy will fail :(. I just tried ignoring them, and ran into this issue. – Gromer Jan 21 '15 at 18:52
0

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.