Closed Xiot closed 9 years ago
I don't think RazorEngine
works with the bundling and minification library. You are welcome to try and submit a pull request. That would be very helpful!
Actually, it looks like it does support it.
I got it working in the sample app adding a reference to Microsoft.AspNet.Web.Optimization
then including the bundle in the cshtml in the usual way. I also needed to add a using in the page as well.
@using System.Web.Optimization
...
@Styles.Render("~/bundles/css")
@Scripts.Render("~/bundles/jquery")
I'm going to have to play with this a little more in my actual application to see what's going on.
@Xiot any further info? I still haven't tried this, but I would love to know what you found and whether or not System.Web.Optimization
works with this formatter.
I haven't touched this in a few months, and recently I've been doing all of my bundling with grunt/gulp. I can re-visit this next week and see what I got working.
Don't worry too much. I imagine most people will move toward grunt/gulp as that seems the "official" direction the ASP.NET team is also taking.
:+1: @Xiot, @panesofglass can we close this issue then?
Ya. If I find some time to check this out again I'll let you know On Jan 5, 2015 8:29 PM, "Pedro Reys" notifications@github.com wrote:
[image: :+1:] @Xiot https://github.com/Xiot, @panesofglass https://github.com/panesofglass can we close this issue then?
— Reply to this email directly or view it on GitHub https://github.com/WebApiContrib/WebApiContrib.Formatting.Razor/issues/16#issuecomment-68812977 .
Is it possible to get bundles rendered?
Adding the @Scripts.Render("~/bundles/bundlename") in the view throws the following exception
I tried this in the provided sample project and got the same issue.
EDIT: I was able to get it to resolve by using a custom HtmlTemplateBase and adding a Scripts property that returns a wrapper around the Scripts static class.
It appears though that the output from the Scripts.Render call is being escaped when it is being written out to the page.