-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to apply transforms to a Bundle like we used to do in Asp.Net MVC 4? #2
Comments
I put together a code sample demonstrating how to achieve this using my library. I don't know where the JSTranslator type comes from (I assume it's some custom component) so I implemented a simple translator transformation. To plug in your own implementation, all you need to do is implement the IBundleItemTransform interface (or inherit from BundleItemTransform class) and register your bundles using this transformation as shown here. Furthermore, I use PO-based translation in the sample. It can be replaced to a resource based or other localization mechanism easily. Just read my comments in the Startup class. |
Thanks Adams for guiding. Bundling is done in Startup.cs =>Configure() method like so:
And here is my JSTranslator component
|
In Asp.Net 4 we use to do bundling via BundleConfig => RegisterBundles via the following way:
That is, a separate bundle will be created for each culture available via list of languageCultures.
Now I can't find way in Asp.Net Core to apply transform to my static files application startup. We used JSTranslator earlier as a transform (shown in code above) for replacing any localizable strings present in .js files w.r.t current UI culture.
How can we do that using your way of Bundling and Minification?
A sample would be of great help. Thanks in advance.
The text was updated successfully, but these errors were encountered: