Welcome to the HTML 5 Boilerplated Optimized ASP.NET MVC 3.01 Web App (clean)
This Visual Studio project is based upon the clean HTML 5 boilerplate solution found at
http://html5boilerplate.com.
This is not the first html5boilerplate.com based Visual
Studio 2010 template to be produced, but as of this initial submission the other
solutions focus on OpenID support rather than solely on purity and automated
optimization. Other features such as OpenID can be added from NuGet, etc.
A few changes were made to the html5boilerplate.com solution in producing this template
in order to make this as clean and pragmatic for a .NET developer
as possible. As html5boilerplate.com's solution utilizes Java-based tools for
optimization, including:
... this implementation instead uses a post-build batch file (see
post-build.bat) and Microsoft's Ajax Minifier which is included in the Tools
directory. Should you choose to instead revert back to YUI Compressor or some
other minifier tool (I might recommend Google Closure Compiler instead) you can
feel free to modify the post-build.bat file to suit your preferences, including
perhaps downloading and adding the html5boilerplate.com tools directory with its
ant build.xml script, but of course any changes to the post-build script will
require that you set up all dependencies and environment configurations as
needed.
Some key things to point out:
- Observe Scripts/app.js. This should be your application client-side script file.
If you want to rename this file, or if you wish to add additional application
logic scripts, you should update the post-build.bat file to reflect the file
changes.
- Take a look at Views/Shared/_Layout.cshtml, which acquired the bulk of
html5boilerplate.com's index.html markup (plus added ASP.NET MVC 3 Razor
semantics).
- Note the Razor view sections that are rendered and where.
- Note also the scripts section placeholder for page-specific scripts not handled
in the app.js file.
- Take a look at Views/Home/Index.cshtml.
- Note the Razor view sections that are populated. Execute the site to see how
this sample page is laid out with Views/Shared/_Layout.cshtml.
- Note also the scripts section implementation for page-specific scripts not
handled in the app.js file.
- Due to the absence of proper documentation on how to use IVsPackageInstaller to invoke
NuGet to install the MVC 3 Refresh dependency packages, you will need to install these
packages manually if you wish them to be NuGet-managed.
- jQuery v1.5.1
- jQuery.vsdoc v1.5.1
- jQuery.Validation v1.8.0
- jQuery.UI.Combined v1.8.11
- EntityFramework v4.1.10331.0
- Modernizr v1.7
- Entity Framework 4.1 is not
referenced at all, so you will have to manually NuGet-install that no
matter what if you intend to
use it.
- The post-build.bat file optimizes these files by default and/or deletes the
optimized versions:
- Content/html5boilerplate-site.css
- This file originated as html5boilerplate.com's css/style.css
- The optimized flavor of this file becomes
Content/html5boilerplate-site.min.css
- Content/html5boilerplate-handheld.css
- This file originated as html5boilerplate.com's css/handheld.css
- The optimized flavor of this file becomes
Content/html5boilerplate-handheld.min.css
- Content/style.css
- This is a clean .css file for your site that is loaded after the
html5boilerplate reset scripts
- The optimized flavor of this file becomes Content/style.min.css
- Scripts/app.js
- This should contain your client-side application logic
- The optimized flavor of this file becomes Scripts/app.min.js
- Scripts/app-plugins.js
- This file originated as html5boilerplate.com's js/plugins.js
- The optimized flavor of this file becomes Scripts/app-plugins.min.js
- All .png files located at Content/Images/*.png
- with optimized versions copied
to Content/Images/optimized/*.png
- The post-build.bat optimizations of .js and .css files are, by default,
performed using Tools/AjaxMin.exe (Microsoft Ajax Minifier).
- The post-build.bat optimizations of .png files are performed using
Tools/optipng.exe
- The default .css and .js files that are optimized are
not optimized
while debugging locally, and this is by design.
- The optimized files are always generated. However,
- web.config defines an application setting called UseMinifiedResources which is
false by default and set to true via web.Debug.config and web.Release.config
transformations during site packing and/or deployment, and
- web.Debug.config transformations do not occur while debugging locally with F5
debugging.
- Meanwhile, one would not want to debug optimized files in the first place!
Alright, so have fun, and good luck.
Jon Davis <jon@jondavis.net>
http://www.jondavis.net/