0.29.3 • Published 3 days ago

@greenwood/plugin-import-jsx v0.29.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

@greenwood/plugin-import-jsx

Overview

Enables usage of import syntax for loading JSX rendering Web Components compatible with WCC. (This is not React JSX!)

This package assumes you already have @greenwood/cli installed.

Installation

You can use your favorite JavaScript package manager to install this package.

examples:

# npm
npm install @greenwood/plugin-import-jsx --save-dev

# yarn
yarn add @greenwood/plugin-import-jsx --dev

Usage

Add this plugin to your greenwood.config.js.

import { greenwoodPluginImportJsx } from '@greenwood/plugin-import-jsx';

export default {
  ...

  plugins: [
    greenwoodPluginImportJsx()
  ]
}

This will then allow you to use import to include WCC compatible JSX rendering Web Components.

export default class FooterComponent extends HTMLElement {
  connectedCallback() {
    this.render();
  }

  render() {
    return (
      <footer>
        <h4>My Blog</h4>
      </footer>
    );
  }
}

customElements.define('app-footer', FooterComponent);

A couple notes:

  • For SSR and prerender use cases, follow these steps
  • For client side / browser code specifically, it is recommended to append ?type=jsx, e.g.
    import '../path/to/footer.jsx?type=jsx';

The plan is to coalesce around import assertions in time for the v1.0 release so the same standard syntax can be used on the client and the server.

0.30.0-alpha.2

3 days ago

0.29.3

5 days ago

0.30.0-alpha.1

2 months ago

0.30.0-alpha.0

2 months ago

0.29.2

4 months ago

0.29.1

5 months ago

0.29.0-alpha.6

6 months ago

0.29.0

6 months ago

0.29.0-alpha.1

10 months ago

0.29.0-alpha.4

8 months ago

0.28.5

9 months ago

0.29.0-alpha.5

7 months ago

0.29.0-alpha.2

9 months ago

0.29.0-alpha.3

9 months ago

0.29.0-alpha.0

11 months ago

0.28.4

11 months ago

0.28.3

12 months ago

0.28.2

1 year ago

0.28.1

1 year ago

0.28.0

1 year ago

0.28.0-alpha.5

1 year ago