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';
44 * @param {Babel } babel
55 * @param {object } [options]
66 * @param {string } [options.tag='html'] The tagged template "tag" function name to produce.
7+ * @param {boolean } [options.terse=false] Output `<//>` for closing component tags
78 * @param {string | boolean | object } [options.import=false] Import the tag automatically
89 */
910export default function jsxToHtmBabelPlugin ( { types : t } , options = { } ) {
@@ -130,9 +131,14 @@ export default function jsxToHtmBabelPlugin({ types: t }, options = {}) {
130131
131132 if ( ! isFragment ) {
132133 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+ }
136142 }
137143 else {
138144 raw ( '</' ) ;
You can’t perform that action at this time.
0 commit comments