10

When the org has no namespace associated with we write Lightning codes like this -

<aura:component extends="c:myComponent">
<aura:component implements="c:myInterface">

where as, when namespace is there the c got replaced with namespace -

<aura:component extends="yournamespace:myComponent">
<aura:component implements="yournamespace:myInterface">

...And many more changes. And I want to do such changes to minimum, so that the developers need not to give time on changing the "c" to "yournamespace" on each and every file. The way we use short form in tag for namespaces in xml, e.g.

<root xmlns:h="http://www.w3.org/TR/html4/">
   <h:table>
       <h:tr>
......

can we use anything similar in lightning code? This will help integrating similar code/code-snippets in different namespaces and increase portability.

1

Certainly not possible now. You're actually talking about supporting namespaces, which we say we do, but we don't really. We support prefixes.

Mapping one prefix to another via an alias isn't supported, and isn't on our backlog.

  • :( Sad... But don't you think it is required for a code to be easy-portable? Otherwise the developer need to check and replace all the old namespace values with the new value. – Plymouth Rock Aug 20 '15 at 4:09
  • I think the messaging is, choose a namespace early and don't change it. We actually had this same issue internally, and it's been a huge pain. But having an alias at the top level would just create other issues about your context. – Kris Gray Aug 20 '15 at 20:05
  • I expect using something say 'c' as the alias in a component but that will not be auto referred in the child components. The alias should be defined in each and every component at the root tag. So developers would require to make changes on every file; no need to change in each line, but the root tag only. – Plymouth Rock Aug 21 '15 at 10:07
  • Having a file directly referenced in your component is not the only way you would get a prefix reference resolution. If from the server I sent you c:foo, you'd resolve that against your components c="othernamespace". What if you pass that component to bar:component, and it has c setup as c="othernamespace2", then c:foo means something different based on what context it's in. – Kris Gray Aug 21 '15 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.