vite-plugin-preserve-drupal-t
v0.0.6
Published
A Vite plugin to preserve Drupal.t during the build process.
Maintainers
Readme
vite-plugin-preserve-drupal-t
A Vite plugin to preserve Drupal.t and Drupal.formatPlural by default during the build process, to ensure they remain unchanged during minification and other transformations. Can optionally receive extra function keywords as parameters.
Installation
You can install the plugin using npm or yarn.
Using npm
npm install vite-plugin-preserve-drupal-t --save-devBasic Usage in Vite configuration
import { defineConfig } from "vite"
import preserveDrupalT from "vite-plugin-preserve-drupal-t"
export default defineConfig({
plugins: [
preserveDrupalT(),
]
})Optional Parameters
Can also optionally receive more function keywords as parameters in the plugin setup, to be included in the transformations dynamically. Uses by default Drupal.t and Drupal.formatPlural.
import { defineConfig } from "vite"
import preserveDrupalT from "vite-plugin-preserve-drupal-t"
export default defineConfig({
plugins: [
preserveDrupalT(['t', 'formatPlural']),
]
})