Trên GitHub, pugjs/babel-plugin-transform-react-pug đã đạt 810 sao, ngôn ngữ JavaScript. A plugin for transpiling pug templates to jsx
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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.
Đọc thêm về pugjs/babel-plugin-transform-react-pug ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/pugjs/babel-plugin-transform-react-pug là nguồn chính thức.
pugjs/babel-plugin-transform-react-pug có bao nhiêu sao?
pugjs/babel-plugin-transform-react-pug có 810 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/pugjs/babel-plugin-transform-react-pug. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
pugjs/babel-plugin-transform-react-pug có phải mã nguồn mở không?
Có — pugjs/babel-plugin-transform-react-pug phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/pugjs/babel-plugin-transform-react-pug.
pugjs/babel-plugin-transform-react-pug có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho pugjs/babel-plugin-transform-react-pug. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
pugjs/babel-plugin-transform-react-pug là gì?
pugjs/babel-plugin-transform-react-pug (pugjs/babel-plugin-transform-react-pug) là dự án JavaScript trên GitHub. Theo mô tả gốc: A plugin for transpiling pug templates to jsx
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về babel-plugin-transform-react-pug?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về babel-plugin-transform-react-pug.