clemvnt / vite-plugin-yaml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vite-plugin-yaml

The plugin was useful with Vite 1 but now that most of the Rollup plugins, including @rollup/plugin-yaml, are compatible with Vite 2, it is recommended to use them.

A Vite plugin for import YAML/YML files as ES6 modules.

Like @rollup/plugin-yaml but for Vite.

Install

Using npm :

npm i -D vite-plugin-yaml

Using yarn :

yarn add -D vite-plugin-yaml

Configuration

vite.config.js

module.exports = {
  plugins: [require('vite-plugin-yaml')]
}

vite.config.ts

const config = {
  plugins: [require('vite-plugin-yaml')]
}

export default config

Usage

You can now import YAML/YML files.

import object from './object.yml'

Check the playground for an example of use.

About


Languages

Language:TypeScript 65.8%Language:HTML 34.2%