5.3.1 • Published 2 months ago

vite-plugin-kirby v5.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Vite Plugin Kirby

A plugin for using Vite with Kirby.

How it works

Development/Production Mode

When Vite runs in development mode, a new file called .dev is created, containing Vite's dev server URL.

VITE_SERVER=http://localhost:5173

kirby-vite, a php plugin for Kirby, can use this file as an indicator to switch into development mode and load scripts and assets from Vite's dev server. When Vite runs in production mode, the .dev file is removed.

Manifest.json

The generation of a manifest.json is enabled automatically.

Static Assets

In order to get static assets to work with kirby-vite, this plugin sets Vite's server origin.

Watch Files

vite-plugin-live-reload is used to watch the following paths:

  • site/(templates|snippets|controllers|models|layouts)/**/*.php
  • content/**/*

You can disable this behavior or define your own paths:

// vite.config.js
import kirby from 'vite-plugin-kirby'

export default {
  // ...

  plugins: [kirby({ watch: false })]
  // or
  plugins: [
    // Note: paths are relative to Vite's root folder.
    kirby({ watch: ['../site/templates/**/*.php'] })
  ]
}

Config

kirby({
  /**
   * Wether templates, snippets, controllers, models and content changes should
   * be watched and cause a reload. Either enable/disable it or provide your own
   * paths to watch.
   * @see https://github.com/arnoson/vite-plugin-live-reload
   * @default true
   */
  watch?: boolean | string[];

  /**
   * The directory in which the `.dev` file is placed.
   * @default process.cwd()
   */
  devDir?: string;
})
5.3.1

2 months ago

5.3.0

3 months ago

5.2.1

3 months ago

5.2.0

3 months ago

5.1.0

6 months ago

5.0.1

6 months ago

5.0.0

6 months ago

4.0.9

7 months ago

4.0.8

7 months ago

4.0.5

9 months ago

4.0.4

9 months ago

4.0.7

8 months ago

4.0.6

9 months ago

4.0.3

9 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.4

1 year ago

0.1.2

1 year ago

0.1.3

1 year ago

0.1.1

2 years ago

0.1.0

2 years ago