Using SquishIt to combine js files has no effect?

2.3k views Asked by At
@{
  ViewBag.Title = "Home Page";
  SquishIt.JavaScript.Add(
    Url.Content("~/Scripts/jquery_ui.js"),
    Url.Content("~/Scripts/jquery_1.4.4.js")
  );
}
@SquishIt.JavaScript.Render(Url.Content("~/Scripts/min.js"))

It shows like this:

<script type="text/javascript" src="/Scripts/jquery_ui.js"></script>`
<script type="text/javascript" src="/Scripts/jquery_1.4.4.js"></script>`

Where is "min.js"?

The two js files are not combine into one js named min.js?

Thanks!

2

There are 2 answers

0
TimH On

Do you have debug="true" in web.config? It must be set to "false" for squishit to work: http://www.codethinked.com/squishit-the-friendly-aspnet-javascript-and-css-squisher

0
Tinman On

To help with debugging, SquishIt does not do anything to the files when in debug mode.

However, you can add a .ForceRelease() call before the .Render(...) call to force it to combine the files as if it's in release mode:

@SquishIt.JavaScript.ForceRelease().Render(Url.Content("~/Scripts/min.js"))