Skip to content

feat(compiler) - Component Namespacing - #843

Closed
tanguyantoine wants to merge 4 commits into
stenciljs:masterfrom
tanguyantoine:tag-namespace
Closed

tanguyantoine wants to merge 4 commits into
stenciljs:masterfrom
tanguyantoine:tag-namespace

Conversation

@tanguyantoine

@tanguyantoine tanguyantoine commented Jun 11, 2018 •

Copy link
Copy Markdown
Contributor

Simplify component namespacing

Purpose of the pull request

Prevent component tag names conflicts across libraries and avoid prefix duplication across the codebase.

Background

Let's assume we have 2 distinct libraries built on top of Stencil: Ionic and Cinoi ;-)

Wouldn't if be awesome to remove unnecessary component scope specification across each codebase by simply provide and expected component tag name prefix ?

At the moment we must specify component prefix within each components

Ionic Team

// card.tsx
@Component({ tag: 'ion-card' })

// jumbotron.tsx
@Component({ tag: 'ion-jumbotron' })

Cinoi Team

// card.tsx
@Component({ tag: 'cin-card' })

// jumbotron.tsx
@Component({ tag: 'cin-jumbotron' })

Pull Request results

Ionic Team

// card.tsx
@Component({ tag: 'card' })

// jumbotron.tsx
@Component({ tag: 'jumbotron' })
//stencil.config.js
{
  componentsPrefix: 'cin'
}

Cinoi Team

// card.tsx
@Component({ tag: 'card' })

// jumbotron.tsx
@Component({ tag: 'jumbotron' })

//stencil.config.js
{
  componentsPrefix: 'cin'
}

@tanguyantoine tanguyantoine mentioned this pull request Jun 11, 2018
1 of 3 tasks
@adamdbradley

Copy link
Copy Markdown
Contributor

Thank you for the PR, but after much discussion with the team we've decided to not include this into the compiler. One of the main reasons is that component CSS may be expecting certain tag names to be styled, but if any consumer can rename components then they'll break. Please feel free to ping us in the stencil slack channel if you have any questions. Thanks

@tanguyantoine

Copy link
Copy Markdown
Contributor Author

Where can I check if that works or not? because this transformer is the first one means that component have the correct tag name later.
Can we imagine opening the transformer part to let people include whatever transformer they want ?

a system like this one : https://github.com/cevek/ttypescript

@say25 say25 mentioned this pull request Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants