@react-pug/babel-plugin-react-pug
v0.1.18
Published
Babel plugin for transforming `pug\`...\`` tagged template literals in React code.
Readme
@react-pug/babel-plugin-react-pug
Babel plugin for transforming pug\...`` tagged template literals in React code.
Install
npm i -D @react-pug/babel-plugin-react-pugUsage
module.exports = {
plugins: [
['@react-pug/babel-plugin-react-pug', {
tagFunction: 'pug',
sourceMaps: 'detailed',
requirePugImport: false,
classShorthandProperty: 'auto',
classShorthandMerge: 'auto',
startupjsCssxjs: 'auto',
componentPathFromUppercaseClassShorthand: true
}]
]
}Options
tagFunction: tagged template function name, defaultpugmode:runtime | languageService, defaultruntimesourceMaps:basic | detailed, defaultbasicrequirePugImport: boolean, defaultfalseclassShorthandProperty:auto | className | class | styleNameclassShorthandMerge:auto | concatenate | classnamesstartupjsCssxjs:never | auto | forcecomponentPathFromUppercaseClassShorthand: boolean, defaulttrue
When a pug import is present and used only for tagged templates, the plugin removes that binding from transformed output. If it was the only specifier in the declaration, the import is rewritten to a side-effect import to preserve module evaluation.
Exports
- default Babel plugin
transformReactPugSourceForBabel(...)mapBabelGeneratedDiagnosticToOriginal(...)
Published output is in dist/.
