es-static-build

1.0.2 • Public • Published

ESBuild Static Tool

CLI tool for statically rendering javascript applications from a single object.

Install

npm i -D es-static-build

Install 'react' or 'preact' for JSX support:

npm i preact preact-render-to-string

Usage

Create a javascript file with an object default export:

import 'preact/debug'
import { render } from 'preact-render-to-string'

export default {
    file: render(<div>file contents</div>),
    folderName: {
        otherFile: render(<div>otherFile contents</div>)
    }
}

Run CLI tool with input and output directories:

npx es-static-build -i src/index.jsx -o dist

To rebuild on file change:

npx es-static-build -w -i src/index.jsx -o dist

You can provide a JSON config file to override the default build configuration options:

esbuild-config.json:

{
    "loader": {
        ".gql": "text"
    }
}

npx es-static-build -i src/index.jsx -o dist -c esbuild-config.json

Readme

Keywords

none

Package Sidebar

Install

npm i es-static-build

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

4.97 kB

Total Files

6

Last publish

Collaborators

  • hunter.shaw