Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(compiler): document transformTagName feature #1452

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/config/extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,7 @@ It is possible to assign data to the actual `<script>` element's `data-opts` pro
### slotChildNodesFix

For browsers that do not support shadow dom (IE11 and Edge 18 and below), slot is polyfilled to simulate the same behavior. However, the host element's `childNodes` and `children` getters are not patched to only show the child nodes and elements of the default slot. Defaults to `false`.

### tagNameTransform

Enables support for the `transformTagName` option of `defineCustomElements()`, so the component `tagName` can be customized at runtime. Defaults to `false`.
20 changes: 20 additions & 0 deletions docs/output-targets/custom-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,26 @@ _default: `false`_

Setting this flag to `true` will cause file minification to follow what is specified in the [Stencil config](../config/01-overview.md#minifyjs). _However_, if [`externalRuntime`](#externalruntime) is enabled, it will override this option and always result in minification being disabled.

## Register Components Manually

If you compile your Stencil components using `dist-custom-elements` and have the `customElementsExportBehavior` property set to `bundle`, you have to manually import the component and register them to the Custom Component Registry using the `defineCustomElements` helper method, e.g.:

```ts
import { defineCustomElements } from 'my-stencil-library'

defineCustomElements({
// options go here
})
```

The function takes the following options:

### transformTagName

_default: `(tagName) => tagName`_

The `transformTagName` function enables to change the component tag name at runtime when registering your component. __Note:__ requires `config.extras.tagNameTransform` option to be set to `true`.

## Making Assets Available

For performance reasons, the generated bundle does not include [local assets](../guides/assets.md) built within the JavaScript output,
Expand Down