rollup-plugin-convert-encoding

0.0.1 • Public • Published

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.

License

MIT License

Package Sidebar

Install

npm i rollup-plugin-convert-encoding

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • kazu69