Skip to content

ngfk/ngx-translate-yaml

Repository files navigation

ngx-translate yaml

Travis CI

Important parts of the webpack config

let languages = fs.readdirSync(path.join(__dirname, 'src', 'i18n'))
  .map(file => path.join(__dirname, 'src', 'i18n', file))
  .filter(path => !fs.statSync(path).isDirectory());

let partialWebpackConfig = {
  entry: {
    main: [
      ...languages,
      path.join(__dirname, 'src', 'main.ts')
    ]
  },

  module: {
    rules: [
      {
        test: /\.ya?ml$/,
        use: [
          {
            loader: 'file-loader',
            options: { name: 'assets/i18n/[name].json' }
          },
          {
            loader: 'yaml-import-loader',
            options: { importRoot: true, output: 'json' }
          }
        ],
        include: path.join(__dirname, 'src', 'i18n')
      }
    ]
  }
}