developit / developit/htm

Optimize adjacent static parts+fields

オープン
#90 コメント 0 件 リアクション 5 件 担当者 0 名 GitHub で見る
enhancement proposal
主要言語
JavaScript
スター
9k
フォーク
181
PR マージ指標
30日以内にマージされた PR はありません

説明

I've been [toying around with optimizing Tagged Templates](https://gist.github.com/developit/7118c02bf0270e1d5751d2a9e22c1faa) by merging literal field values (strings, numbers and booleans) into their adjacent static part and collapsing the adjacent static parts into a single part:

```js
// input:

hello

// current output:
html`

hello
`
html ``

// optimized output:
html`

`
html`
`
```

It'd be really neat to get this behavior into `babel-plugin-transform-jsx-to-htm`, since additional assumptions could be made about nested Arrays:

```js
const color = 'red';

// input:
{`
.foo { color: ${color}; }
`}

// current output:
html`
${`
.foo { color: ${color}; }
`}
`

// optimized output:
html`

.foo { color: ${color}; }

`
```

Thoughts?

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the linked Tagged Templates gist and the babel-plugin-transform-jsx-to-htm entry point. Compare the current and optimized outputs shown for literal fields and nested arrays; done means the plugin produces the requested optimized output for both examples.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
babel, javascript
領域
compilers, tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。