File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
packages/babel-plugin-transform-jsx-to-htm Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import jsx from '@babel/plugin-syntax-jsx';
4
4
* @param {Babel } babel
5
5
* @param {object } [options]
6
6
* @param {string } [options.tag='html'] The tagged template "tag" function name to produce.
7
+ * @param {boolean } [options.terse=false] Output `<//>` for closing component tags
7
8
* @param {string | boolean | object } [options.import=false] Import the tag automatically
8
9
*/
9
10
export default function jsxToHtmBabelPlugin ( { types : t } , options = { } ) {
@@ -130,9 +131,14 @@ export default function jsxToHtmBabelPlugin({ types: t }, options = {}) {
130
131
131
132
if ( ! isFragment ) {
132
133
if ( isComponentName ( name ) ) {
133
- raw ( '</' ) ;
134
- expr ( name ) ;
135
- raw ( '>' ) ;
134
+ if ( options . terse ) {
135
+ raw ( '<//>' ) ;
136
+ }
137
+ else {
138
+ raw ( '</' ) ;
139
+ expr ( name ) ;
140
+ raw ( '>' ) ;
141
+ }
136
142
}
137
143
else {
138
144
raw ( '</' ) ;
You can’t perform that action at this time.
0 commit comments