1. Some/Many hosting providers will give you trouble publishing bundled CSS, even though bundled JS works fine. Mine (GoDaddy) screams about invalid access to the bundled CSS, it does not like the new URL for such LINK, even though it handles bundled JS
well.
2. Bundling CSS that uses LESS could be a trouble. Although there was a video where it was used somehow, the keyword is "somehow" - I couldn't find out anywhere how it is possible. All I can see - the bundling gets stuck on the LESS syntax, showing error.
3. Was the CSS Bundling mechanism designed with the vew on supporting conditional CSS? I feel it was not. If you can't wrap up conditional CSS into your bundle - it could be a big problem for the whole CSS bundling.
4. Bundling as a whole doesn't work in the latest Opera, while it seems to work happily in any other browser. Opera just doesn't like the new URL-s with hashcode appended to them. I have published this on Opera website, we'll see what comes out of it, but
for many developers it is a show-stopper with regards to MVC Bundling, because I don't see how such issue can be worked around.
While nobody answers, just an update on the issue with Opera...
According to DOM + Network details within Opera, it does load a bundle as it should, but it then fails to process the bundle correctly. I will continue my investigation there...
Since you are getting this problem only in GoDaddy, therefor I will not able to test your cases. BTW,
VitalyT
1. Some/Many hosting providers will give you trouble publishing bundled CSS, even though bundled JS works fine. Mine (GoDaddy) screams about invalid access to the bundled CSS, it does not like the new URL for such LINK, even though it handles bundled JS well.
Try, to append the same querystring in normal MVC 4 request. This will let you know whether this issue(url) is specific with GoDaddy and ASP.NET is not interfering the request. You can also log something in BeginRequest event to make sure that ASP.NET is
not reached.
VitalyT
2. Bundling CSS that uses LESS could be a trouble. Although there was a video where it was used somehow, the keyword is "somehow" - I couldn't find out anywhere how it is possible. All I can see - the bundling gets stuck on the LESS syntax, showing error.
Use Custom bundling.
VitalyT
3. Was the CSS Bundling mechanism designed with the vew on supporting conditional CSS? I feel it was not. If you can't wrap up conditional CSS into your bundle - it could be a big problem for the whole CSS bundling.
If you are talking about Conditional IE comments then you can include seperate bundles.
VitalyT
4. Bundling as a whole doesn't work in the latest Opera, while it seems to work happily in any other browser. Opera just doesn't like the new URL-s with hashcode appended to them. I have published this on Opera website, we'll see what comes out of it, but for
many developers it is a show-stopper with regards to MVC Bundling, because I don't see how such issue can be worked around.
Tested in Localhost and found no issue.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
In the beginning he talks about MVC4 Bundling and Minification, showing piece of code where he uses class LessMinify passed into DynamicFolderBundle as one of initialization parameters. Unfortunately, there is no detail where LessMinify comes from or what
it does. For all I know, as I'm adding MVC4's System.Web.Optimization.dll into my MVC3 project, that class isn't there :)
3. You are right here, although it does create an additional bundle, but I guess nothing can be done there.
4. It must be down to certain functionality, maybe, it is unknown, I will have to continue my investigation here, as much as care about Opera :)
In the beginning he talks about MVC4 Bundling and Minification, showing piece of code where he uses class LessMinify passed into DynamicFolderBundle as one of initialization parameters. Unfortunately, there is no detail where LessMinify comes from or what
it does. For all I know, as I'm adding MVC4's System.Web.Optimization.dll into my MVC3 project, that class isn't there :)
Just for your information, I had watched this video when it was released. I think LessMinify is custom one. may be it will be avilable in RC release.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
I got some good news :) I have figured out two issues. First off, I tried that code you suggested in the other post:
MVC4 Less Bundle @import Directory
I changed my code according to that (below), and it worked!
protected void Application_Start()
{
// initial code...
BundleTable.Bundles.Add(CreateCssBundle());
}
private Bundle CreateCssBundle()
{
Bundle bundle = new Bundle("~/Content/css", new LessMinify());
bundle.AddFile("~/Content/Styles.css");
bundle.AddFile("~/Content/jquery.fancybox.css");
bundle.AddFile("~/Content/jquery.fancybox-buttons.css");
bundle.AddFile("~/Content/jquery.fancybox-thumbs.css");
return bundle;
}
public class LessMinify : CssMinify
{
public LessMinify() { }
public override void Process(BundleContext context, BundleResponse response)
{
response.Content = Less.Parse(response.Content);
base.Process(context, response);
}
}
After that I found out why I was running into security issue with CSS bundle and not with JS bundle. I had folder Content/css created in my hosting root as a result of some earlier deployments. It is the presense of that folder that screwed up acessibility
to the CSS bundle, because we pass Content/css, where css is actually a filter, there cannot be a folder with such name.
So, I got issues 1 - 3 off the table, much thanks to you! ;)
The only issue remains - number 4: Opera cannot process JS bundle correctly. I will keep looking at it.
VitalyT
Member
2 Points
16 Posts
MVC4 Bundling Problems
May 04, 2012 11:45 AM|LINK
Problems, without any priority.
1. Some/Many hosting providers will give you trouble publishing bundled CSS, even though bundled JS works fine. Mine (GoDaddy) screams about invalid access to the bundled CSS, it does not like the new URL for such LINK, even though it handles bundled JS well.
2. Bundling CSS that uses LESS could be a trouble. Although there was a video where it was used somehow, the keyword is "somehow" - I couldn't find out anywhere how it is possible. All I can see - the bundling gets stuck on the LESS syntax, showing error.
3. Was the CSS Bundling mechanism designed with the vew on supporting conditional CSS? I feel it was not. If you can't wrap up conditional CSS into your bundle - it could be a big problem for the whole CSS bundling.
4. Bundling as a whole doesn't work in the latest Opera, while it seems to work happily in any other browser. Opera just doesn't like the new URL-s with hashcode appended to them. I have published this on Opera website, we'll see what comes out of it, but for many developers it is a show-stopper with regards to MVC Bundling, because I don't see how such issue can be worked around.
VitalyT
Member
2 Points
16 Posts
Re: MVC4 Bundling Problems
May 04, 2012 01:00 PM|LINK
While nobody answers, just an update on the issue with Opera...
According to DOM + Network details within Opera, it does load a bundle as it should, but it then fails to process the bundle correctly. I will continue my investigation there...
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: MVC4 Bundling Problems
May 06, 2012 11:26 AM|LINK
Since you are getting this problem only in GoDaddy, therefor I will not able to test your cases. BTW,
Try, to append the same querystring in normal MVC 4 request. This will let you know whether this issue(url) is specific with GoDaddy and ASP.NET is not interfering the request. You can also log something in BeginRequest event to make sure that ASP.NET is not reached.
Use Custom bundling.
If you are talking about Conditional IE comments then you can include seperate bundles.
Tested in Localhost and found no issue.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
VitalyT
Member
2 Points
16 Posts
Re: MVC4 Bundling Problems
May 06, 2012 11:42 AM|LINK
Thank you for your reply, so I'll keep the numbering thing here also ;)
1. I will try to investigate this further.
2. There is a very nice video on the Internet, of Scott Gurthie giving speech at Techdays 2012 event on the new features of MVC4:
A look at ASP.NET MVC
In the beginning he talks about MVC4 Bundling and Minification, showing piece of code where he uses class LessMinify passed into DynamicFolderBundle as one of initialization parameters. Unfortunately, there is no detail where LessMinify comes from or what it does. For all I know, as I'm adding MVC4's System.Web.Optimization.dll into my MVC3 project, that class isn't there :)
3. You are right here, although it does create an additional bundle, but I guess nothing can be done there.
4. It must be down to certain functionality, maybe, it is unknown, I will have to continue my investigation here, as much as care about Opera :)
Cheers! :)
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: MVC4 Bundling Problems
May 06, 2012 12:11 PM|LINK
Just for your information, I had watched this video when it was released. I think LessMinify is custom one. may be it will be avilable in RC release.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
VitalyT
Member
2 Points
16 Posts
Re: MVC4 Bundling Problems
May 06, 2012 12:41 PM|LINK
Hello again,
I got some good news :) I have figured out two issues. First off, I tried that code you suggested in the other post: MVC4 Less Bundle @import Directory
I changed my code according to that (below), and it worked!
protected void Application_Start() { // initial code... BundleTable.Bundles.Add(CreateCssBundle()); } private Bundle CreateCssBundle() { Bundle bundle = new Bundle("~/Content/css", new LessMinify()); bundle.AddFile("~/Content/Styles.css"); bundle.AddFile("~/Content/jquery.fancybox.css"); bundle.AddFile("~/Content/jquery.fancybox-buttons.css"); bundle.AddFile("~/Content/jquery.fancybox-thumbs.css"); return bundle; } public class LessMinify : CssMinify { public LessMinify() { } public override void Process(BundleContext context, BundleResponse response) { response.Content = Less.Parse(response.Content); base.Process(context, response); } }After that I found out why I was running into security issue with CSS bundle and not with JS bundle. I had folder Content/css created in my hosting root as a result of some earlier deployments. It is the presense of that folder that screwed up acessibility to the CSS bundle, because we pass Content/css, where css is actually a filter, there cannot be a folder with such name.
So, I got issues 1 - 3 off the table, much thanks to you! ;)
The only issue remains - number 4: Opera cannot process JS bundle correctly. I will keep looking at it.
Cheers!