Skip to content

martinkruusement/vite-plugin-pkl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vite-plugin-pkl

npm version MIT License

PKL file import plugin for Vite.

Uses @pkl-community/node-packages package for parsing.

Warning

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.

About

Import .pkl files as Javascript objects in Vite

Resources

License

Stars

Watchers

Forks

Packages

No packages published