소스 검색

Manage the whitespace produced by the compiler

master
Dylan Baker 5 년 전
부모
커밋
69dc0975d0
1개의 변경된 파일2개의 추가작업 그리고 6개의 파일을 삭제
  1. 2
    6
      src/compiler.js

+ 2
- 6
src/compiler.js 파일 보기

@@ -11,11 +11,7 @@ module.exports = class Compiler {
11 11
         const attributes = node.args.map(arg => `${arg.attributeName}="${this.compileAttribute(arg.attributeValue)}"`)
12 12
         const compiler = new Compiler(node.subtree, this.context)
13 13
         const content = compiler.compile()
14
-        this.result += `
15
-          <${node.functionName}${attributes.length ? ' ' : ''}${attributes.join(' ')}>
16
-            ${content}
17
-          </${node.functionName}>
18
-        `
14
+        this.result += `<${node.functionName}${attributes.length ? ' ' : ''}${attributes.join(' ')}>${content}</${node.functionName}>`
19 15
       } else if (node.type === 'string') {
20 16
         this.result += node.content
21 17
       } else if (node.type === 'identifier') {
@@ -23,7 +19,7 @@ module.exports = class Compiler {
23 19
       }
24 20
     })
25 21
 
26
-    return this.result
22
+    return this.result.trim()
27 23
   }
28 24
 
29 25
   compileAttribute(attribute) {

Loading…
취소
저장