pugjs/babel-plugin-transform-react-pug is a open-source project on GitHub, written primarily in JavaScript. It has 810 stars. A plugin for transpiling pug templates to jsx
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Install eslint-plugin-react-pug if you use eslint-plugin-react.
CSS Modules
Whether you use babel plugin to turn on CSS Modules specifically for JSX (e.g. babel-plugin-react-css-modules) or use webpack loader for that to transform styles into key-value object, it's possible to use it with pug.
With babel-plugin-react-css-modules you need to set classAttribute option to styleName value and that's it.
We don't need transform-react-jsx here because it's coming with react-native preset.
How it works
Coming soon...
Limitations
We can't use dots in component names because pugjs treats everything after dot as a className. For example, React.Fragment becomes <React className="Fragment" />, not <React.Fragment />
A nice workaround is made by babel-plugin-transform-jsx-classname-components. Just add it to .babelrc:
We don't support html language in pug templates. This is different than what Pug promises.
However, you can still use tag interpolation:
p Good #[strong Morning]
FAQ
Can I import template from other files?
The short answer is no and we are not going to implement that in near future. Take a look at initial request with small explanation (#15).
How to get syntax highlighting in IDE (or text editors)?
WebStorm
Atom
Visual Studio Code
WebStorm
Open settings
"Editor" -> "Language Injections"
Click on Add new "Generic Js" injection
See how to find this section (youtrack.jetbrains.com/issue/WEB-22106#focus=streamItem-27-2451611-0-0)
Name: Pug In Template Literals (JavaScript)
ID: Vue (Vue.js template) (current version of pug plugin is created in HTML scope, so we use workaround here)
Prefix: <template lang="pug">
Suffix: </template>
Places Patterns: + taggedString("pug")
Click "OK" and "Apply"
Atom
Install language-babel and language-pug-jade
I suggest language-pug-jade because it works better for me. But there are more approaches for building pugjs grammar: language-pug and atom-pug, and you can try them too.
Open settings of language-babel in atom
Find the field under "JavaScript Tagged Template Literal Grammar Extensions"
Enter: pug:source.pug
More details: gandm/language-babel#javascript-tagged-template-literal-grammar-extensions
Restart the atom
Visual Studio Code
Open settings of extensions
Search "vscode-react-pug" by the search field
Click "Install" and "Reload"
If you use any grammar other than default one (e.g. Babel JavaScript which is quite popular), you might need to add supporting of Atom's Grammar (Microsoft/vscode-js-atom-grammar).
Check out the history beyond that: kaminaly/vscode-react-pug#4.
Does pugjs/babel-plugin-transform-react-pug have a project website?
No homepage URL was recorded for pugjs/babel-plugin-transform-react-pug in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
How many stars does pugjs/babel-plugin-transform-react-pug have?
pugjs/babel-plugin-transform-react-pug has 810 GitHub stars — refresh the page for the live number, or check github.com/pugjs/babel-plugin-transform-react-pug. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is pugjs/babel-plugin-transform-react-pug open source?
Yes — pugjs/babel-plugin-transform-react-pug ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/pugjs/babel-plugin-transform-react-pug.
What is pugjs/babel-plugin-transform-react-pug?
pugjs/babel-plugin-transform-react-pug (pugjs/babel-plugin-transform-react-pug) is a JavaScript project on GitHub. From the project's own README: A plugin for transpiling pug templates to jsx
Where do I read more about pugjs/babel-plugin-transform-react-pug?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/pugjs/babel-plugin-transform-react-pug is the definitive source.
Read full README in the tab above.
Is babel-plugin-transform-react-pug worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of babel-plugin-transform-react-pug.