Closed ashwin027 closed 7 years ago
Sorry, I should probably add this to the bundle transformer account instead of this one. Im closing this out. My apologies.
Hello, Ashwin!
I recommend you to use the custom item transformation (implements System.Web.Optimization.IItemTransform
interface) for these purposes. Details can read in the “BundleTransformer.Less inject variables depending on context/request” discussion (second way) on Stack Overflow.
On CodePlex not working notifications.
I tried the solution and it works fine, except that it doesnt work in debug mode.
On Stack Overflow in comments described solution for this problem:
Hernan! In Bundle Transformer 1.9.0 Beta 1 implemented this functionality - bundletransformer.codeplex.com/releases/view/123398. In order to the debugging HTTP-handlers can use a transformations from bundles need to add in the
RegisterBundles
method ofApp_Start/BundleConfig.cs
file the following code:BundleResolver.Current = new CustomBundleResolver();
Also I recommend you to read the “Running Autoprefixer with BundleTransformer / LESS in Debug mode” discussion.
Firstly, this library has been really useful so thanks for all the work. I have an issue that Im trying to work through. Here is the scenario,
Packages installed: LibSassHost 1.0.0 LibSassHost.Native.win-x86 1.0.0
Im trying to dynamically add sass variables at runtime to the response content in a custom transformer, like so,
In testTransformer, Im trying to add to response.content with some variables that override other variables.
When I ran this, the transforms run correctly and the content is updated, but the bundletransformer library reads the file instead of the response content and completely ignores all other transforms.
It would be nice if it can read the response content instead of the file because the response content already has the contents from all the files in the bundle. MVC already gives us this. You could avoid an unnecessary file read and make the solution more extendible.
Is it possible to maybe add a configurable option to use content instead of reading the file again?