Install the nymus
package with npm
:
npm install --save-dev nymus
typescript
is also needed if .d.ts
files are to be generated.
webpack can be configured to compile certain JSON files with nymus
as follows:
module.exports = {// ...module: {rules: [// ...{test: /\.json$/,include: [path.resolve(__dirname, './locales/')],type: 'javascript/auto',use: [{loader: 'nymus/webpack',options: { locale },},],},],},};
nymus [...options] [...files]
Use the --help
option to get an overview of the available options.
import createModule from 'nymus';const MESSAGES = {Welcome: 'Hi there, {name}',};createModule(MESSAGES).then(({ code }) => console.log(code));