Rollup plugin to convert files from one encoding to another, built on top of encoding package.
npm install --save-dev rollup-plugin-encoding
Add the following lines to your rollup.config.js
:
import encoding from 'rollup-plugin-encoding';
export default {
// ...
plugins: [
encoding({
src: 'src/fileToEncode.js',
dest: 'dist/encodedFile.cp1251.js',
toCharset: 'CP1251',
verbose: true
})
]
}
or
import encoding from 'rollup-plugin-encoding';
export default {
// ...
plugins: [
encoding([
{src: 'src/fileToEncode1.js', dest: 'dist/encodedFile1.js', toCharset: 'CP1251'},
{src: 'src/fileToEncode2.js', dest: 'dist/encodedFile2.js', toCharset: 'CP1251'},
// ...
])
]
}
src:<string>
* - path to the file to be encodeddest:<string>
* - path where to put encoded filetoCharset:<string>
* - the charset to convert tofromCharset:<string>
- (optional, default'UTF-8'
) the source charsetverbose:<boolean>
- (optional, defaultfalse
) display verbose message