Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
.vs/config Upgrade to latest deps Feb 4, 2018
App_Data Upgrade to v4 Jan 14, 2014
App_Start Upgrade to MVC4 Nov 1, 2014
Content Upgrade to latest deps Feb 4, 2018
Controllers
Logic fix whitespace Mar 1, 2016
Models Upgrade to v4.5.0 Aug 30, 2016
Properties Upgrade to v4.0.46 Sep 29, 2015
Scripts
ServiceInterface Upgrade to v4.5.0 Aug 30, 2016
Support Upgrade to v4 Jan 14, 2014
Views modify web.config to get MVC3 working in IIS7+ Aug 1, 2016
bundler Upgrade to MVC4 Nov 1, 2014
AppConfig.cs
AppHost.cs Upgrade to latest deps Feb 4, 2018
Bundler.cs
Global.asax
Global.asax.cs Upgrade to MVC4 Nov 1, 2014
README.txt Update to v3.9.42 of NuGet, delete tracked bin/ files Mar 19, 2013
SocialBootstrapApi.csproj Upgrade to latest deps Feb 4, 2018
SocialBootstrapApi.sln Upgrade to v4.0.46 Sep 29, 2015
Web.Debug.config Upgrade to MVC4 Nov 1, 2014
Web.Release.config Upgrade to MVC4 Nov 1, 2014
Web.config Upgrade to latest deps Feb 4, 2018
packages.config Upgrade to latest deps Feb 4, 2018

README.txt

To enable MVC Html helper's add ServiceStack.Mvc namespace to your views base class by editing your Views/Web.config:

  <system.web.webPages.razor>
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="ServiceStack.Mvc" />    <!-- Enable Html Exentions -->
      </namespaces>
    </pages>
  </system.web.webPages.razor>
  

To get Started, define bundles in your /Content directory. For illustration An Example 'app.js.bundle' and 'app.css.bundle' text files are defined below:

[/Content/app.js.bundle]
js/underscore.js
js/backbone.js
js/includes.js
js/functions.coffee
js/base.coffee
bootstrap.js

[/Content/app.css.bundle]
css/reset.css
css/variables.less
css/styles.less
default.css

Now everytime you run '/bundler/bundler.cmd' it will scan these files, compiling and minifying any new or changed files. 
Tip: Give **bundler.cmd** a keyboard short-cut or run it as a post-build script so you can easily re-run it when your files have changed.

You can then reference these bundles in your MVC _Layout.cshtml or View.cshtml pages with the @Html.RenderCssBundle() and @Html.RenderJsBundle() helpers:

The different BundleOptions supported are:

  public enum BundleOptions
  {
    Normal,              // Left as individual files, references pre-compiled .js / .css files
    Minified,            // Left as individual files, references pre-compiled and minified .min.js / .min.css files
    Combined,            // Combined into single unminified app.js / app.css file
    MinifiedAndCombined  // Combined and Minified into a single app.min.js / app.min.css file
  }

With the above bundle configurations, the following helpers below:

@Html.RenderCssBundle("~/Content/app.css.bundle", BundleOptions.Minified)
@Html.RenderJsBundle("~/Content/app.js.bundle", BundleOptions.MinifiedAndCombined)

will generate the following HTML:

<link href="/Content/css/reset.min.css?b578fa" rel="stylesheet" />
<link href="/Content/css/variables.min.css?b578fa" rel="stylesheet" />
<link href="/Content/css/styles.min.css?b578fa" rel="stylesheet" />
<link href="/Content/default.min.css?b578fa" rel="stylesheet" />

<script src="/Content/app.min.js?b578fa" type="text/javascript"></script>


You can’t perform that action at this time.