Nuxt Obfuscator
a nuxt module to easily obfuscate/mangle your css class names when building the project
Quick Setup
- Add
nuxt-obfuscator
dependency to your project
pnpm add -D nuxt-obfuscator
yarn add --dev nuxt-obfuscator
npm install --save-dev nuxt-obfuscator
- Add
nuxt-obfuscator
to the end of modules
section of nuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-obfuscator'
],
obfuscator: {
mapFile: 'obfuscation.map.json',
nameLength: 7,
defaultExtensions: ['.html', '.vue', '.jsx', '.tsx', '.ts', '.js'],
exclude: [],
excludeClassNames: [/^nuxt-.*$/, /^vue-.*$/, /^.*?(-enter.*|-leave.*)$/],
dev: false,
}
})
Optional Steps (Recommended)
- Build the project once using
yarn generate
or yarn build
to generate the obfuscation map and add it to git to keep the class names consistent across builds
Development
npm install
npm run dev:prepare
npm run dev
npm run dev:build
npm run lint
npm run test
npm run test:watch
npm run release