This project has moved and is read-only. For the latest updates, please go here.

Do not use *.min.js

Oct 4, 2012 at 12:26 PM

Hello!

Is it possibility to disable use the minimized script files?

I do not know why, but after the update some libraries (jquery.validate, jquery.validate.unobtrusive,
json2) they do not work on a public server. The reason is that the development computer in debug mode do not use compressed script files, and the public - are used. If I exclude compressed script files from the project it works on a public server perfectly, YuiJsMinifier perfectly fulfills compression.

But always remember to remove the compressed files from the project is very difficult. I want to be able to remove compressed script files with the option in Bundle Transformer and all the work on the compression pass to YuiJsMinifier library. It is possible to implement?

Many thanks for the great library.  It fix problems with compressed scripts (jquery) in Opera.

Oct 6, 2012 at 8:53 AM

Hello, tstar!

While I do not plan to implement this functionality.

Have you checked your web application in a release mode on development computer? If on development computer everything works, then try to remove all scripts on public server (there might be old versions of scripts) and copied to server scripts from your computer.

Oct 9, 2012 at 4:05 PM

Hello!

If I set BundleTable.EnableOptimizations = true; on developer machine - I have the same problems with scripts like on public server. I think - the problem in minimized scripts that came with the javascript libraries, because, I want reminimize scripts that were tested on developer machine. I had same problems with the opera, which did not want to work with jQuery scripts minimized by standard library. So, I started to use your library, and all was well for a long time, but after the update some javascript libraries are all broken.

PS: By the way, the new version YUICompressor .NET 2.1.0.0 does not work for me too.

 

Oct 9, 2012 at 4:27 PM

Problem with YUICompressor .NET 2.1.0.0 I decide in new release (I plan to do a few days).

What you are using a JS-libraries?

Oct 9, 2012 at 4:43 PM
Edited Oct 9, 2012 at 4:46 PM

I use last versions of:

 

bundles.Add(new Bundle("~/JS/Core", jsTransformer) { Orderer = nullOrderer }.Include(

 "~/Scripts/jquery-{version}.js", 

"~/Scripts/jquery-ui-{version}.js",  

 

"~/Scripts/jquery-ui-i18n.js",  

"~/Scripts/jquery.validate.js",

"~/Scripts/jquery.validate.unobtrusive.js", -> first error on this library

"~/Scripts/jquery.globalize/globalize.js",

"~/Scripts/jquery.globalize/cultures/globalize.culture.uk.js",

"~/Scripts/json2.js",

"~/Scripts/autoNumeric.js",

"~/Scripts/jquery.qtip.js"));

Oct 9, 2012 at 4:50 PM

Usually when compressing YUICompressor changes the text encoding of JS-files. Perhaps some of the libraries has incorrect text encodings. Try convert libraries to UTF-8.

Oct 9, 2012 at 10:47 PM

YUICompressor works fine if there is no compressed files, which it uses to optimize the speed, passing the original files. The problem may be in the encoding, but to change it even more inconvenient than just delete the compressed files from the project. I want to completely trust the Bundle Transformer and a YUICompressor that they compressed all the files without using compressed versions. Thank you.

Oct 12, 2012 at 12:22 PM

Hello, tstar!

I implement the feature, that you have requested, in the Bundle Transformer 1.6.5.

In the configuration elements css and js added the usePreMinifiedFiles attribute, which enables/disables usage of pre-minified files:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  ...
  <!-- Bundle Transformer configuration settings -->
  <bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
    <core>
      <css usePreMinifiedFiles="true">
        ...
      </css>
      <js usePreMinifiedFiles="true">
        ...
      </js>
      ...
    </core>
    ...
  </bundleTransformer>
  <!-- /Bundle Transformer configuration settings -->
  ...
</configuration>
Simply set to one of these attributes a value equal false.

Oct 12, 2012 at 1:53 PM

Fantastic! It works! Thank you so much.

But at the first run I got error:

While minimizing the JS-code read from the file C: \Projects\Test\Scripts\jquery-1.8.2.js, using YUI JS-minifier error has occurred!
See more information about the error:

Object reference not set to an instance of an object.
Object reference not set to an instance of an object.
   в BundleTransformer.Yui.Minifiers.YuiJsMinifier.Minify(IList`1 assets)
   в BundleTransformer.Core.Transformers.TransformerBase.Minify(IList`1 assets)
   в BundleTransformer.Core.Transformers.JsTransformer.Transform(IList`1 assets, BundleResponse bundleResponse, HttpContextBase httpContext)
   в BundleTransformer.Core.Transformers.TransformerBase.Process(BundleContext context, BundleResponse response)
   в System.Web.Optimization.Bundle.ApplyTransforms(BundleContext context, String bundleContent, IEnumerable`1 bundleFiles)
   в System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context)
   в System.Web.Optimization.Bundle.GetBundleResponse(BundleContext context)
   в System.Web.Optimization.Bundle.ProcessRequest(BundleContext context)
   в System.Web.Optimization.BundleHandler.ProcessRequest(HttpContext context)
   в System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   в System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

But the more I did not see this error.

But there was another problem - its YUICompressor .NET 2.1.0.0. It does not work if the form is used @Html.AntiForgeryToken() and [HttpPost][ValidateAntiForgeryToken] in controller. I have not updated it because of this problem. But Bundle Transformer 1.6.5 now has a hard link with YUICompressor .NET 2.1.0.0. Now the pages with forms is not working. Is it possible to go back to the old version of YUICompressor .NET, because it is a problem of library? And I can not find a solution on the Internet. In any case, I will show You an error message.

Type initializer "System.Web.Helpers.AntiForgery" threw an exception.
Type initializer "System.Web.Helpers.Claims.ClaimsIdentityConverter" threw an exception.
Could not load file or assembly "Microsoft.IdentityModel, Version = 3.5.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35" or one of its dependencies. Can not find the dynamic library DllImport.
Cannot find embedded resource assembly named Yahoo.Yui.Compressor.Resources.Microsoft.IdentityModel.dll
   in System.Web.Helpers.AntiForgery.Validate ()
   in System.Web.Mvc.ValidateAntiForgeryTokenAttribute.OnAuthorization (AuthorizationContext filterContext)
   in System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters (ControllerContext controllerContext, IList `1 filters, ActionDescriptor actionDescriptor)
   in asyncCallback, Object asyncState)
   in System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult `1.Begin (AsyncCallback callback, Object state, Int32 timeout)
   in System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction (ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state)
   in System.Web.Mvc.Controller. <> c__DisplayClass1d. <BeginExecuteCore> b__17 (AsyncCallback asyncCallback, Object asyncState)
   in System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult `1.Begin (AsyncCallback callback, Object state, Int32 timeout)
   in System.Web.Mvc.Controller.BeginExecuteCore (AsyncCallback callback, Object state)
   in System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult `1.Begin (AsyncCallback callback, Object state, Int32 timeout)
   in System.Web.Mvc.Controller.BeginExecute (RequestContext requestContext, AsyncCallback callback, Object state)
   in System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute (RequestContext requestContext, AsyncCallback callback, Object state)
   in System.Web.Mvc.MvcHandler. <> c__DisplayClass8. <BeginProcessRequest> b__2 (AsyncCallback asyncCallback, Object asyncState)
   in System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult `1.Begin (AsyncCallback callback, Object state, Int32 timeout)
   in System.Web.Mvc.MvcHandler.BeginProcessRequest (HttpContextBase httpContext, AsyncCallback callback, Object state)
   in System.Web.Mvc.MvcHandler.BeginProcessRequest (HttpContext httpContext, AsyncCallback callback, Object state)
   in System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest (HttpContext context, AsyncCallback cb, Object extraData)
   in System.Web.HttpApplication.ExecuteStep (IExecutionStep step, Boolean & completedSynchronously)

Sorry for the large amount of text and my English.

Once again thank you for the cool library.

Oct 12, 2012 at 2:03 PM

Unfortunately, YUICompressor. NET 2.1.0.0 already rollback is not possible.

Oct 15, 2012 at 10:38 AM

I have the same problem on live, but on dev it works properly. 

Cannot find embedded resource assembly named Yahoo.Yui.Compressor.Resources.App_GlobalResources.ee1w2f0a.resources.dll

 

It looks like in Yahoo.Yui.Compressor.Resources.*.resources.dll instead of * it try during the compilation put resources which is using on this page.

Oct 15, 2012 at 2:13 PM

Hello, Klepa!

If you have everything working correctly in release mode on the developer's server, but does not work on the live server, it just means 2 things:

  1. Code on servers is different
  2. Servers settings is different

You have repeatedly wrote to me about such errors. As a rule, these were errors of deployment.

You must understand, that the Bundle Transformer is an Open Source-project, but is not a service of pay support.