Code Monkey home page Code Monkey logo

Comments (11)

lifus avatar lifus commented on July 19, 2024

I'm not sure that I understand but it seems to me that built-in wro4j model interpolation might be exactly what you are looking for.

from wro4j-runtime-taglib.

tveimo avatar tveimo commented on July 19, 2024

That one would allow me to prefix included resources in a group to load them from different places, but what I need is to have output from the Script/StylesheetTag like

<script src='//keycdn-14576.keycdn.com/resources/core-52b380f59cd70730bccbf2da93a87595.js'>  
</script>

if I use the script tag like

<c:set var="cdn" value="//keycdn-14576.keycdn.com" />
<!-- spring profile dependent -->
<wro:script group="core" prefix="${cdn}" />

from wro4j-runtime-taglib.

lifus avatar lifus commented on July 19, 2024

Does it make sense to make it application-wide or you need a more fine-grained control over your resources?
e.g. I might support something like

resourceDomain=//keycdn-14576.keycdn.com

in wro.properties. This would affect all resources though

from wro4j-runtime-taglib.

tveimo avatar tveimo commented on July 19, 2024

This would be sufficient in my case, since we load all css/js resources from the cdn.

from wro4j-runtime-taglib.

lifus avatar lifus commented on July 19, 2024

Alright, changes are on resourceDomain branch. Tests are green but I didn't have a chance to test it on actual CDN so I would keep it there for a while.

from wro4j-runtime-taglib.

tveimo avatar tveimo commented on July 19, 2024

Ok, it works well, if configured in the wro.properties file. However, when configuring through spring, wro.properties might be loaded from elsewhere, eg. if using a different wro.properties file depending on the deployment profile.

See eg. https://groups.google.com/forum/#!msg/wro4j/GUQ9zmDDVbw/E0VzlrC7dEUJ

I'm not sure what's the best approach here. Would it be possible to retrieve the configuration properties from the wroManagerFactory?

from wro4j-runtime-taglib.

lifus avatar lifus commented on July 19, 2024

You might override ConfigurableWroManagerFactory#newConfigProperties.
e.g. you may store common properties in wro.properties and put all environment-specific properties in wro-{environment}.properties. Then you might load them based on current spring environment profile

from wro4j-runtime-taglib.

tveimo avatar tveimo commented on July 19, 2024

True, but I still can't override resourceDomain only for the production environment, since it's loaded using ServletContextPropertyWroConfigurationFactory which fetches the wro.properties file from a hardcoded location.

from wro4j-runtime-taglib.

lifus avatar lifus commented on July 19, 2024

Right, I forgot that there is no such thing as single source of properties in wro4j.
I should probably introduce something like Wro4jManagerFactory to taglib.
In the mean time, you might fallback to something like this.

from wro4j-runtime-taglib.

tveimo avatar tveimo commented on July 19, 2024

Ok, I might use a workaround for now. The current setup I've got is pretty good at the moment.

from wro4j-runtime-taglib.

lifus avatar lifus commented on July 19, 2024

Closing this one for now as I'm going to include current implementation in 0.2.0 release. Feel free to reopen it

from wro4j-runtime-taglib.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.