Using the Microsoft Ajax Minifier with Web Setup project & Source Control

后端 未结 2 965
遥遥无期
遥遥无期 2021-01-15 11:59

I\'ve just started investigating the Microsoft Ajax Minifer 4.0 for use with a Visual Studio 2008 Web Application I work on. It\'s proven easy enough to hook it into the .cs

相关标签:
2条回答
  • 2021-01-15 12:29

    The solution I eventually opted for was to include the minifier DLL in my project and create a handler (.ashx) that I've replaced all references to .js files with, so:

    <script src="MyJsFile.js" type="text/javascript"></script>
    

    Is replaced with

    <script src="Minifier.ashx?file=MyJsFile.js" type="text/javascript"></script>
    

    I have a configuration setting in my web.config file that allows me to determine whether script files are minifed or not.

    0 讨论(0)
  • 2021-01-15 12:46

    Using the Microsoft Ajax Minifier with Source Control

    The Microsoft Ajax Minifier generates the minified JavaScript and CSS files as the output of the build process. For this reason, we recommend that you handle the minified files in exactly the same way as you would handle the assemblies generated by the build process. In particular, we recommend that you do not include the minified files in your Visual Studio project and that you do not check the minified files into source control.

    If you include the minified files in your project, and you use source control, then you will encounter problems. When files are checked out of source control, they are checked out with their read-only attributes set. If you attempt to do a build, the Microsoft Ajax Minifier will generate an error when it attempts to write to a read-only file.

    source : Microsoft

    From my understanding, this means do not add the -min files to the project, that's it. When IIS will build the app, it will create the files automatically. I think you must have Microsoft Minifier 4.0 to be installed on the web server tho.

    0 讨论(0)
提交回复
热议问题