Giter VIP home page Giter VIP logo

Comments (23)

totherik avatar totherik commented on July 27, 2024

We had planned to add a feature to support something along the lines of an import or include pragma, which could allow one to reference other bundles. Would that contribute to solving this problem/question?

from makara.

mderrick avatar mderrick commented on July 27, 2024

This does sound like it might, how do you envisage it being used?

Ideally I would want to just use common.* seamlessly in any template.

from makara.

totherik avatar totherik commented on July 27, 2024

the thought was that any given property bundle could merely include another property bundle. Something along the lines of:

// @import "base/common"
foo=bar
baz=YOLO

If that doesn't fulfill what you're looking for, we're all still really interested in hearing about more use-cases/constraints.

from makara.

lmarkus avatar lmarkus commented on July 27, 2024

Would it be a good idea to have an "implied" import?
eg: reserved_name.properties is always included

Sounds an awful lot like globals 😨

from makara.

mstuart avatar mstuart commented on July 27, 2024

Anyone working on this currently? If not, I can help. This would be a huge win for keeping it DRY. Especially for common words like "Submit", "Next", etc. I understand the argument that you can take that common word and refactor it out to yet another dust partial w/ an associated properties file, but partials shouldn't be the only answer. It'd be great to have import statements like Erik posted above... // @import "base/common"!! /cc @bluelnkd @xjamundx

from makara.

xjamundx avatar xjamundx commented on July 27, 2024

A weirder way would be a sense of inheritance, where you could inherit from something else and automatically get (and be able to override its properties). Probably @import is better though ;-)

from makara.

jeffharrell avatar jeffharrell commented on July 27, 2024

@mstuart No, it is not actively being worked on. If you want to pick it up that would be awesome!

I would just say to comment back on this issue with a design once you have a handle on it.

from makara.

mstuart avatar mstuart commented on July 27, 2024

Cool, thanks!

But, I'd like to know why we moved away from the @useContent helper in the first place? I can see how there can be performance problems, but as long as you're easy on file I/O and caching common bundles, it shouldn't be terrible.

Just wanted to make sure this PR isn't going to be denied and this is something you really want.

from makara.

jeffharrell avatar jeffharrell commented on July 27, 2024

@useContent was dynamic in that it expected the content to exist as part of the page model. Since we moved to doing content at build time and removing the need to send the content over the wire with each request, we adopted @pre instead.

When you ask about @useContent are you specifically looking for being able to access content at runtime, or being able to load arbitrary content bundles? Each is a distinct problem, but I think the latter is more pressing (and what you're looking for). The solve should still be build time IMO, so what about offering up something like {@pre type="content" bundle="common" key="foo" /} with an optional bundle attribute that allows you to override the bundle?

from makara.

mstuart avatar mstuart commented on July 27, 2024

I basically wanted to use it as an import statement during build-time, so it ensures that those extra bundles are available for the @pre tags to use. Lately, I haven't seen a use case for content bundles being sent down to the UI so I think this is fine (it's super wasteful anyways). Now it's just a matter of style. I like your suggestion too but wanted to offer up another alternative where you specify your imports at the top. Let me know what you think and I'll run with it

A. Import statement w/ @pre tags

(Template filename - addCard.dust)

{@import bundles="common=common, transfer=bank/transfer" /}
or
// @import "common=common, transfer=bank/transfer"

<h2>{@pre type="content" key="greeting" /}</h2>
<button>{@pre type="content" key="common.next" /}</button>
<p>{@pre type="content" key="transfer.help" /}</p>

B. Optional bundle attribute

(Template filename - addCard.dust)

<h2>{@pre type="content" key="greeting" /}</h2>
<button>{@pre type="content" bundle="common" key="next" /}</button>
<p>{@pre type="content" bundle="bank/transfer" key="help" /}</p>

from makara.

elankeeran avatar elankeeran commented on July 27, 2024

@mstuart I tried both your options but none of them are working. Is there anything else that I need to take care. And I am using latest code.

from makara.

jeffharrell avatar jeffharrell commented on July 27, 2024

@elankeeran this issue is still open so @mstuart's sample code is a proposal for an interface. Have thoughts around it?

from makara.

elankeeran avatar elankeeran commented on July 27, 2024

@jeffharrell I would go with the #2 option, that way I don't have to unnecessarily import the bundle in page top. Let me know the tentative date for delivery?

from makara.

mstuart avatar mstuart commented on July 27, 2024

@elankeeran I'm hoping to deliver it in the next couple of weeks... so mid-April.

from makara.

kellyrmilligan avatar kellyrmilligan commented on July 27, 2024

hello, any progress on this @mstuart, any way I can help? I definitely want to have a file at the root of US/en or something where for a specific locale you can have a set of common properties, then if I want to overwrite in a template I can. IMO I don't think a developer should have to import it them selves in the template.

from makara.

mstuart avatar mstuart commented on July 27, 2024

Hi @kellyrmilligan, I haven't been able to find time to work on this, yet. I can probably carve out some time at the end of the month. If you want to work on this earlier, feel free! I can help collaborate with you on it and provide my thoughts/feedback.

from makara.

kellyrmilligan avatar kellyrmilligan commented on July 27, 2024

absolutely. we definitely need to be able to specify a common set of properties. If you can provide some general direction/what you were thinking high level, we can both fork and collaborate that way.

from makara.

pbhadauria2000 avatar pbhadauria2000 commented on July 27, 2024

Hi @mstuart , I modified the code and got the option B working. Got mocha test cases taken care as well. I am currently going through the grunt task ("dustjs-18n".js file). In order to get it working, I will have to change a bit more than I anticipated. Are you open for some re-designing of the grunt task to achieve the same functionality?

from makara.

erikmueller avatar erikmueller commented on July 27, 2024

@mstuart and @pbhadauria2000, glad that this is being worked on. I'd also opt for Option B. Looking forward for the integration 👍 Any time frame foreseeable?

from makara.

scobo avatar scobo commented on July 27, 2024

+1 for Option B. 👍

from makara.

aredridel avatar aredridel commented on July 27, 2024

We're considering an "include" option in the bundles themselves, as an option C:

include=../../US/en/bundle.properties

from makara.

pbhadauria2000 avatar pbhadauria2000 commented on July 27, 2024

Guys, I have a working Option B code. Will be sending pull request within a week

from makara.

aredridel avatar aredridel commented on July 27, 2024

We're actually swinging back toward dynamism and using @useContent, with a loader to bind messages to a source.

from makara.

Related Issues (20)

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.