From d93969a9eedb9e8ab050a695c68590cb7957257e Mon Sep 17 00:00:00 2001 From: nvms Date: Wed, 9 Oct 2024 14:33:06 -0400 Subject: [PATCH] ok --- README.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ea7a15..c8fb5bd 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,72 @@ ``` # esr -This is a simple esbuild-powered dev server. It has livereloading. It's fast. +This is a simple esbuild-powered dev server. It has livereloading. It's fast. It's configured with YAML. The end. + +## Example configuration + +```yml +# Defaults +bundle: true +platform: browser +format: esm +outdir: public +minify: false +minifyWhitespace: false +minifyIdentifiers: false +sourcemap: true + +# Optional. Applies to `--serve`, or `--run --watch`. +# Files that match these paths trigger reload or rerun when they are changed. +watch: + paths: ['src/**/*.{ts,tsx}', 'public/index.html'] + +# Each mode inherits from the configuration above, but can +# override certain options as needed. +serve: + html: public/index.html + port: 1234 + +# When building, you might want to override some of the defaults +build: + minify: true + minifyWhitespace: true + minifyIdentifiers: true + sourcemap: false + +run: + # For example: + runtime: bun + +jsx: automatic +jsxFactory: React.createElement + +# By default, loader is undefined. +# You can define loaders with the `loader` property, like this: +loader: + .js: jsx + .ts: tsx +``` + +When serving an index.html, you can use `{{ livereload }}` to inject the livereload EventSource logic, and `{{ js }}` to inject a script tag for the built output file. + +```html + + + + + + + Application + + + +
+ {{ livereload }} + {{ js }} + + + +```