Reputation: 3781
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:
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.
Upvotes: 0
Views: 1152
Reputation: 2112
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?
Upvotes: 1