0.1.1 • Published 11 months ago

unplugin-fluent v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

unplugin-fluent npm

Use all the power of the fluent project with your favorite bundler/compiler 🌊

ci test test test test

Transform your fluent files into compiled fluent resources

Usage

Import your .ftl files, that's all!!!

import enUs from './locales/en-us.ftl'
import esMx from './locales/es-mx.ftl'

// create your bundles
const bundle = new FluentBundle('en-US', { useIsolating: false })
const bundle = new FluentBundle('es-MX', { useIsolating: false })

Install

npm i -D @fluent/bundle unplugin-fluent

pnpm add -D @fluent/bundle unplugin-fluent
// vite.config.ts
import fluent from 'unplugin-fluent/vite'

export default defineConfig({
  plugins: [
    fluent({ /* options */ }),
  ],
})

Example: playground/

// rollup.config.js
import fluent from 'unplugin-fluent/rollup'

export default {
  plugins: [
    fluent({ /* options */ }),
  ],
}

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-fluent/webpack')({ /* options */ })
  ]
}

// nuxt.config.js
export default defineNuxtConfig({
  modules: [
    ['unplugin-fluent/nuxt', { /* options */ }],
  ],
})

This module works for both Nuxt 2 and Nuxt Vite

// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-fluent/webpack')({ /* options */ }),
    ],
  },
}

// esbuild.config.js
import { build } from 'esbuild'
import fluent from 'unplugin-fluent/esbuild'

build({
  plugins: [fluent()],
})

Note: Unplugin fluent compiles your fluent files into FluentResources, sometimes this behavior can increase ypur bundle size in favor of performance

0.1.1

11 months ago

0.1.0

11 months ago