WebReflection/ucontent

External HTML components escaped

Opened this issue ยท 3 comments

Hi! ๐Ÿ‘‹
I'm working on a component helper library to be shared across multiple projects, which uses ucontent to generate server-side markup for each component. However, the two separate instances of ucontent (component lib & project) are incompatible for rendering markup. The component markup is escaped as text instead of live html (but works properly if I copy/paste the component library source into the project repo and use the same ucontent instance).

I believe the problem is caused by the prefix for uparser in utils.js using Date.now(). Is this timestamp necessary for proper functionality?

I've cloned the repo here and removed the timestamp, which seems to fix things. I'm cautious though, since I'm not sure if the internal parser depends on a unique prefix for proper caching / whatnot.

Happy to create a demonstration repo if that helps.

Thanks for your help and your great collection of libraries!

Happy to create a demonstration repo if that helps.

yes please, as I've no idea what you are actually talking about. any reduced test case that shows what/where is the issue would help me helping you.

thanks

Demo repo with an external and internal component

Hope this helps. Let me know if there's anything else I can do or if I'm misunderstanding something.

Upon further investigation, my initial guess of the problem was incorrect. The "fix" was using a local version of ucontent and using "npm link" instead of referencing a remote module.

Has nothing to do with the timestamp, and I've updated the demo repo to reproduce the local vs remote ucontent discrepancy.

Seems like ucontent treats independent ucontent instances as foreign and escapes them. Currently working around this by wrapping my imported components with raw(), but I'd prefer to import directly if that's possible (-: