0

Environment:

Microsoft Visual Studio Professional 2013 Version 12.0.31101.00 Update 4 Microsoft .NET Framework Version 4.5.51209

I have a website project that contains some javascript files. Visual Studio minifies javascript files automatically -- for example, if the "source" file is called "myscript.js" -- Visual Studio will also create a minified version called: "myscript.min.js" -- which is great...

When I right-click on the file name in Solution Explorer and select "Publish myscript.js" - Visual studio publishes three files:

  • myscript.js
  • myscript.min.js
  • myscript.min.js.map

However, I want to publish ONLY the minified version of the file to the web site -- problem is, if I use the "Exclude From Project" setting (right-click on "myscript.js" -> Exclude From Project"); Visual studio will also exclude the minified version of the source file.

Is there a setting in Visual Studio that allows us to specify that only the minimized version of the file be published when selecting the "Publish" option within Solution Explorer???

PLEASE NOTE: I am NOT asking for an MSBuild or MSDeploy solution (this is NOT a web APPLICATION; it is a website project) -- I want to be able to publish a single file at a time (in this case javascript) but I do NOT want the main source file published -- only the minified version.

The only solution I have found is to manually publish the minified version, and then manually delete the "source" file from the web site; but it would be nice if Visual Studio had a setting that would prevent the javascript "source" file from being uploaded to the server.

Perhaps no such option exists? (Guess I am just looking for confirmation).

Thanks.

bdcoder
  • 3,280
  • 8
  • 35
  • 55

1 Answers1

1

My advice would be to use Web Essentials (http://vswebessentials.com/) and go to Web Essentials => Edit Global JSCS Settings (.jscssrc) and add

"excludeFiles": ["scripts/myfile.js","app/services/*", "app/controllers/*"]

More info here: How can I configure Web Essentials 2013 to ignore files?

Community
  • 1
  • 1
Darxtar
  • 2,022
  • 22
  • 21
  • Yes, thanks -- I came across this while searching as well. I really would like to see an option whereby we could simply toggle (or mark) which files get published and which do not via solutions explorer in Visual Studio -- such a feature would be most welcome for those of us that have to maintain small website projects. – bdcoder Jul 20 '15 at 17:27