vite-plugin-pkl
v0.1.1
Published
Import .pkl files as Javascript objects in Vite
Downloads
4
Readme
vite-plugin-pkl
PKL file import plugin for Vite.
Uses @pkl-community/node-packages package for parsing.
[!WARNING]
- This is an experimental plugin and depends on @pkl-community/node-packages.
- Check https://github.com/pkl-community/node-packages/issues for known issues.
Install
npm install vite-plugin-pkl --save-dev
Add it in vite.config.js
:
import pkl from 'vite-plugin-pkl'
export default {
plugins: [
pkl(),
// ...other vite plugins
]
}
Options
plugins: [
pkl({
debug: true // default: false - Output before/after in Vite console.
}),
Example
Import like a regular JSON file:
import test from './test.pkl'
console.log(test.key) // 'value'
Known issues
- Some expressions need to be escaped with a backslash:
"Hello, \(bird.name)!"
- No Windows support yet.