SquishIt icon indicating copy to clipboard operation
SquishIt copied to clipboard

Empty <style> tag rendered for some CSS files instead of correct <link> tag

Open 0liver opened this issue 8 years ago • 1 comments

We minify our css files like this:

var path = "/Themes/One/Styles/one.css";
var name = "one";
@MvcHtmlString.Create(Bundle.Css().Add(path).Render(string.Format("~/bdls/{0}_#.css", name))

Unfortunately, for some of our files we get the output <style></style> instead of the desired <link href="/bundles/theme_ABCDEFG.css" rel="stylesheet" type="text/css" />. This is very weird and it is dependent on the css file being processed by the SquishIt.

I would like to understand where in the processing pipeline the error occurs but I have no clue where and how to configure SquishIt to tell me more about that. Is logging available? Exceptions? Anything?

By the way, trying to use the NullMinifier helped in getting the <link /> rendered, but the referenced file was empty.

0liver avatar Sep 08 '16 10:09 0liver

What version are you using? What minifier? (default is AjaxMin).

I have not seen this, and would probably need a project to reproduce it.

You might want to try using the YUI minifier, I've personally had much better results with it.

Bundle.ConfigureDefaults().UseYUIForCssMinification()

The only place I know of where we intentionally render style tags is when debugging - if arbitrary content is included in a bundle and maybe embedded resources.

AlexCuse avatar Sep 08 '16 19:09 AlexCuse