question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Namespace/prefix all the classes?

See original GitHub issue

As the Prism can be embedded in different environments, there could be already any of the class names that Prism uses, like tag, token, number etc. So it’s possible that those styles would override or change Prism’s.

The usual way to fix that is to use some prefix for all the classes used in Prism, so we can add the prism- prefix to all those classes: prism-tag, prism-token, prism-number etc.

I can’t see any serious drawbacks, the gzip would cover neglect all the added prefixes.

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
LeaVeroucommented, Jul 12, 2012

Absolutely not. I’m very firm on this one. I’m fed up seeing scripts with awful prefixed class names, making everything uglier just for the off chance there might be a collision.

What we could do, is add .token before each class selector, since every token also has this class as well. So .number would become .token.number.

6reactions
LeaVeroucommented, Mar 29, 2016

Hi @jonmilner,

When I said “first complaint I get, I change the selectors”, it was 2012 and Prism had just been released. Now it’s way too late, as it would break tons of sites, plugins, themes etc. Having human readable names was a design decision that I made pretty early on in this project. I knew there was a chance of collision, but the advantages outweighed the disadvantages and there are plenty of workarounds for collisions.

That said, perhaps this can be solved by just prefixing all Prism selectors with "code " so they don’t apply to any random area in the page. Can anyone think of any drawbacks to this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Namespace Prefix | Apex Developer Guide
The Salesforce application supports the use of namespace prefixes . Namespace prefixes are used in managed AppExchange packages to differentiate custom object ...
Read more >
apex - Get Namespace Prefix from calling class
Now for all my test class written, I would have set this flag to true IMarkerInterface.RUN_TRIGGER = true; in my test methods, so...
Read more >
xml - How to add namespace prefix to class element in c#
Use a XmlSerializerNamespaces as such : var id = new Identification() { DEANumber = "qwe", NPI = 123, }; var serializer = new ......
Read more >
Changing Namespace Prefix Properties | Microsoft Learn
You can control namespace prefixes when serializing an XML tree in C# and Visual Basic. To do this, insert attributes that declare namespaces....
Read more >
Customization Namespace Prefix (The Java EE 5 Tutorial)
Customization Namespace Prefix. All standard JAXB binding declarations must be preceded by a namespace prefix that maps to the JAXB namespace URI ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found