lit-element-transpiler
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Coverage Status Build Status npm version License: MIT

lit-element-transpiler

LitElement code transpiler (import css and scss file and inline to your component also transpile decorators to native javascript)

Getting Started

git clone https://github.com/aelbore/lit-element-transpiler.git
npm install

Installation

  npm install --save-dev lit-element-transpiler

Usage

  • Code

      import * as mockfs from 'mock-fs'
      import * as fs from 'fs'
     
      import { transform } from 'lit-element-transpiler'
     
      mockfs({
        './src/hello-world.ts': `
          import { LitElement, html, customElement, property } from 'lit-element'
          import './hello-world.css'
     
          @customElement('hello-world')
          class HelloWorld extends LitElement { 
            
            @property() message
     
          } 
        `
        './src/hello-world.css':`
          h1 {
            color: red
          }
        `
      })
     
      const content = await fs.promises.readFile('./src/hello-world.ts', 'utf-8')
      const { code, map } = await transform('./src/hello-world.ts', content)
  • Output

      import { LitElement, css } from 'lit-element'
     
      class HelloWorld extends LitElement { 
        static get properties() {
          return {
            message: { type: String }
          }
        }
     
        static get styles() {
          return css `
            h1 { color: red }
          `
        }
      } 
     
      customElements.define('hello-world', HelloWorld)

Package Sidebar

Install

npm i lit-element-transpiler

Weekly Downloads

3

Version

0.1.0

License

ISC

Unpacked Size

41.2 kB

Total Files

13

Last publish

Collaborators

  • aelbore