diff --git a/README.md b/README.md index 38dc5a6..c7f595d 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,18 @@ A extension for [Zodiac](https://github.com/brettatoms/zodiac) to build and serve static assets. -This extension is uses [Vite](https://vite.dev/) and doesn't try to abstract -away the features of Vite or the JS platform tools. Instead this extension +This extension is built with [Vite](https://vite.dev/) and doesn't try to +abstract away the features of Vite or the JS platform. Instead this extension embraces JS as a platform for building static assets and provides very simple wrappers for serving the static assets. For example this extension only allows you to set the Vite config file path for -the build step and any other Vite configuration options should be set in the -Vite config file. If you want to run Vite in watch mode you will need to set +the build step. Any other Vite configuration options should be set in the Vite +config file. + +To run Vite in watch mode you will need to set [build.watch](https://vite.dev/config/build-options.html#build-watch) to true in -t `build.watch` he Vite config file. +the Vite config file. For an example of how to use this extension see [examples/todo-app](examples/todo-app). @@ -46,9 +48,11 @@ For an example of how to use this extension see [examples/todo-app](examples/tod :config-file (str (fs/path project-root "vite.config.js")) ;; The manifest path is the relative resource ;; path to the output manifest file. This value doesn't override the build - ;; time value for the output path of the manifest file. + ;; time value for the output path of the manifest file. By default + ;; the manifest file is written to /.vite/manifest.json :manifest-path "myapp/.vite/manifest.json" - ;; The resource path the the built assets. + ;; The resource path the the built assets. By default the build assets + ;; are written to /assets :asset-resource-path "myapp/assets"})] (z/start {:extensions [assets-ext] :routes routes}) @@ -65,6 +69,8 @@ import { defineConfig } from "vite" export default defineConfig({ build: { + // The resources/ folder will need to be on the Java classpath. e.g. add it to + // the :src key in your deps.edn file. outDir: "resources/myapp", manifest: true, rollupOptions: { @@ -92,6 +98,6 @@ The `zodiac.ext.assets/init` accepts the following options: Defaults to `true`. - `:cache-manifest?`: Set to true to cache the manifest file the first time it is read instead of reading it on every request. This will improve the - performance of getting the build asset paths performance when `vite build` to - build the assets. Set to `false` if running vite in watch mode. Set to `true` - in production. Defaults to `false`. + performance of resolve the assets paths from the `manifest.json`. Set to + `false` if running vite in watch mode. Set to `true` in production. Defaults + to `false`.