一覧へ戻る
giorgi94/rollup-plugin-astext(新しいタブで開きます)
主要言語: JavaScript
Import file as string
- star 数
- 0
- watcher 数
- 1
- fork 数
- 0
- issue 数
- 0
- 最終更新
- 2019/08/19
主要言語: JavaScript
Import file as string
This plugin enables to import files, such as .json or .svg, as string variables.
$ npm install git+https://github.com/giorgi94/rollup-plugin-astext.git
// rollup.config.js import astext from 'rollup-plugin-astext'; export default { input: './src/index.js', plugins: [ astext({ extensions: [".json", ".svg"] // default [".json"] }) ], };
An optional extensions array with file extensions tells which imports should be imported as plain text.
// data.json { "a": 8 } // index.js import data from "./data.json"; console.log(data) /* data -> '{ "a": 8 }' */