0.0.2 • Published 8 years ago
webpack-iconv-plugin v0.0.2
webpack-iconv-plugin
Webpack plugin to change encoding of output. This plugin depends on node-iconv.
Usage
//webpack.config.js
const WebpackIconvPlugin = require("webpack-iconv-plugin");
module.exports = {
//...your webpack config
plugins: [
new WebpackIconvPlugin("UTF-8", "SHIFT-JIS", "TRANSLIT", { "\\\\" : "¥" })
]
};WebpackIconvPlugin(from, to, whenUntranslatable, preReplaceMap)
from/to
Encoding of input and output. See here to know supported encordings.
whenUntranslatable
How to deal with an input including untranslatable chars. See here to know available settings.
- TRANSLIT
- IGNORE
preReplaceMap
Correspondence table of chars to replace before translation.
For instance, in case of converting from UTF-8 to SHIFT-JIS, \ could not be translated. To escape characters, SHIFT-JIS uses ¥ instead of \.
We want to replace \ as ¥ before translation of iconv. In this case, we pass a map of chars:
{
"\\\\" : "¥"
}LICENSE
MIT