{"id":27,"date":"2013-04-05T07:52:00","date_gmt":"2013-04-05T07:52:00","guid":{"rendered":"https:\/\/wdev-blog.azurewebsites.net\/index.php\/2013\/04\/05\/minify-js-and-css-files-in-visual-studio-2012\/"},"modified":"2013-04-05T07:52:00","modified_gmt":"2013-04-05T07:52:00","slug":"minify-js-and-css-files-in-visual-studio-2012","status":"publish","type":"post","link":"http:\/\/panahy.nl\/index.php\/2013\/04\/05\/minify-js-and-css-files-in-visual-studio-2012\/","title":{"rendered":"Minify js and css files in Visual Studio 2012"},"content":{"rendered":"<p>Finally we got an integrated tool in VS2012 that does the jobin Solution Explorer:<br \/><b>Web Essentials<\/b><br \/>You can enable this tool using the Extensions And Updates from the TOOLS menu.<\/p>\n<p><\/p>\n<ol>\n<li>First, right-click on the css file and from the Web Essentials context menu choose to <b>Minify CSS Files<\/b>. This will ensure that with every build it will generate the accompanying .min.css file too.<\/li>\n<li>Make sure you have the Web.Release.config beside your web.config<\/li>\n<li>In your .aspx or .master file put an if statement to figure out if this is running on your debug mode or release mode:<\/li>\n<\/ol>\n<pre>.<br \/> &lt;% if (HttpContext.Current.<b>IsDebuggingEnabled<\/b>) { %&gt;<br \/>    &lt;link href=\"\/css\/MyFile.css\" rel=\"stylesheet\" type=\"text\/css\"&gt;&lt;\/link&gt;<br \/>  &lt;%} else {%&gt;<br \/>    &lt;link href=\"\/css\/MyFile.min.css\" rel=\"stylesheet\" type=\"text\/css\"&gt;&lt;\/link&gt;<br \/>  &lt;%} %&gt;<br \/>.<br \/><br \/><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Finally we got an integrated tool in VS2012 that does the jobin Solution Explorer:Web EssentialsYou can enable this tool using the Extensions And Updates from the TOOLS menu. First, right-click on the css file and from the Web Essentials context menu choose to Minify CSS Files. This will ensure that with every build it will &hellip; <a href=\"http:\/\/panahy.nl\/index.php\/2013\/04\/05\/minify-js-and-css-files-in-visual-studio-2012\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Minify js and css files in Visual Studio 2012&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Pouya Panahy","author_link":"http:\/\/panahy.nl\/index.php\/author\/pouya\/"},"uagb_comment_info":0,"uagb_excerpt":"Finally we got an integrated tool in VS2012 that does the jobin Solution Explorer:Web EssentialsYou can enable this tool using the Extensions And Updates from the TOOLS menu. First, right-click on the css file and from the Web Essentials context menu choose to Minify CSS Files. This will ensure that with every build it will&hellip;","_links":{"self":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/27"}],"collection":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":0,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"wp:attachment":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/tags?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}