Browse Source

Don't include ="" for attributes with empty string

master
Dylan Baker 5 years ago
parent
commit
60c6d9a24a
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      src/compiler.js

+ 7
- 2
src/compiler.js View File

@@ -70,9 +70,14 @@ module.exports = class Compiler {
70 70
     let result = `<${node.functionName.name}`
71 71
 
72 72
     node.args.filter(arg => arg.constructor.name === 'Attribute').forEach(arg => {
73
-      result += ` ${arg.name}=`
73
+      result += ` ${arg.name}`
74
+
74 75
       let compiler = new Compiler([arg.value], this.context)
75
-      result += `"${compiler.compile()}"`
76
+      let attrValue = compiler.compile()
77
+
78
+      if (attrValue) {
79
+       result += `="${attrValue}"`
80
+      }
76 81
     })
77 82
 
78 83
     result += '>'

Loading…
Cancel
Save