rollup-plugin-convert-encoding
v0.0.1
Published
Rollup plugin to file encode.
Downloads
3
Maintainers
Readme
Rollup Convert Encoding Plugin
This Rollup plugin converts file encoding.
Usage
Install
npm install rollup-plugin-convert-encode
Setup
example for rollup.config.js
import encode from 'rollup-plugin-convert-encoding';
const dist = 'dist/converted.js';
const options = {
dist: dist,
encodingFrom: 'EUC-JP',
encodingTo: 'SHIFT_JIS'
}
export default {
input: 'example/index.js',
plugins: [ encode(options) ],
output: [
{
format: 'cjs',
file: dist
}
]
};
Options
dist
Type: string Default: null
File output destination.
encodingFrom
Type: string Default: utf8
Original file encoding.
encodingTo
Type: string Default: utf8
Output file encoding.
iconv
Type: object Default: {decode: {}, encode: {}}
iconv-lite BOM Handling option.
About encodings
The plugin uses iconv-lite to handle the encoding. Support encodings listed on the iconv-lite page.