Skip to content
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

Spring.Web.Optimization integration in Spring.Web #106

Closed
djechelon opened this issue Mar 24, 2015 · 1 comment
Closed

Spring.Web.Optimization integration in Spring.Web #106

djechelon opened this issue Mar 24, 2015 · 1 comment

Comments

@djechelon
Copy link
Contributor

Hello, I have a feature request to propose.

You all know about Web Optimization Framework. One of its features is bundle mapping for styles and scripts. It is currently done via code using the BundleTable class. For example:

        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                    "~/Scripts/jquery.validate*"));

More advanced users map bundles to their official (or project-supplied) CDN.

On my own, a few years ago, I have made an XML-based configuration of the bundles, so these could be changed without recompiling the application. I don't know about its real utility in common projects, because normal product lifecycles require that a change in the Javascript/CSS fileset (e.g. adding/changing version of Bootstrap) is treated as a change and it's easy for a project manager to require a code change to map the new JS/CSS bundle to a library.

Anyway I have created a parser that automatically maps bundles to the BundleTable according to the following syntax

<bundle xsi:type="StyleBundle" virtualPath="~/bundles/metro-style-dark-blue" cdnPath="http://some.cdn">
    <include>~/Content/themes/dark-blue.css</include>
</bundle>

<bundle xsi:type="StyleBundle" virtualPath="~/bundles/metroStyle">
    <include>~/Content/base.css</include>
    <include>~/Content/skeleton.css</include>
    <include>~/Content/layout.css</include>
</bundle>

<bundle xsi:type="ScriptBundle" virtualPath="~/bundles/jQuery">
    <include>~/Scripts/jquery-{version}.js</include>
    <include>~/Scripts/jquery-ui-{version}.js</include>
    <include>~/Scripts/jquery.easing.{version}.js</include>
    <include>~/Scripts/plugins.all.js</include>
    <!--<include>~/Scripts/jquery.address-{version}.js</include>-->
    <include>~/Scripts/selectivizr.js</include>
</bundle>

I do currently have defined an XML schema, a ConfigurationSection element and a utility class. Currently my implementation doesn't support transformations yet (very useful to add). I won't show for brevity.

In order to start the discussion, and later provide code, I would ask the Spring team if you are interested in adding support for System.Web.Optimization in the Spring context file, so that the developer can add bundles to the BundleTable according to a similar syntax in the web context file. That would be automagically activated by the Spring Web context once the proper tag is found in the XML.
(Similarly for code-based configuration).

Thank you for your time.

post scriptum: I read about the bundles.config file (that is supposed to do everything my implementation does) but I have found no information about it. My code was built about 3 years ago

@lahma
Copy link
Collaborator

lahma commented Oct 15, 2022

I'm doing a rude experiment with closing this, like what stale bot does, but maybe more human as I will probably actually react to feedback. As this issue has been stale for so long, I'll close it. If it's still an issue you would like to pursue, we can definitely reopen.

With limited resources this is just something that we need to do. Thank you for your understanding.

@lahma lahma closed this as completed Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants