Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
brettatoms committed Nov 12, 2024
1 parent c2df8ed commit 76ab503
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down Expand Up @@ -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 <outDir>/.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 <outDir>/assets
:asset-resource-path "myapp/assets"})]
(z/start {:extensions [assets-ext]
:routes routes})
Expand All @@ -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: {
Expand Down Expand Up @@ -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`.

0 comments on commit 76ab503

Please sign in to comment.