webpack-phraseapp-builder

2.0.0 • Public • Published

Webpack PhraseAppBuilder Plugin

Webpack plugin for generating translations files from PhraseApp. This plugin uses the download API endpoint from PhraseApp, for further information please see the following link This plugin will run before the Webpack compilation, so the translations are available before the Webpack assertions.

Since this plugin will download the translations before the assertions, is not recommended to use the same path as the output path for Webpack assertions

Install

To install the package run the following command:

  npm install -D webpack-phraseapp-builder

Usage

In your webpack.config.js

var PhraseAppBuilderPlugin = require('webpack-phraseapp-builder');
 
module.exports = {
    // ...
    plugins: [
      new PhraseAppBuilderPlugin({
        accessToken: 'theAccesTokenId',  // Get your accessToken from PhraseApp
        projectId: 'theProjectId', // Get the project id from PhraseApp
        outputPath: 'path',
        format: 'json' // specify the format from Phraseapp
      })
    ]
};

This will generate translations files in your configured output directory, for example:

// src/translations/es.json
 
{
  "some.key": "hello",
}

Options:

  • localesId: The locales id from your PhraseApp project.
  • accessToken: The accessToken to authorize the PhraseApp API.
  • outputPath: The path where you want to download the translations.
  • projectId: The project id from PhraseApp from where you want to extract your translations
  • format: The format to download the translations

Readme

Keywords

Package Sidebar

Install

npm i webpack-phraseapp-builder

Weekly Downloads

10

Version

2.0.0

License

MIT

Last publish

Collaborators

  • joseaplwork
  • cornerjob