alibaba / rax

🐰 Rax is a progressive framework for building universal application. https://rax.js.org
Other
7.99k stars 627 forks source link

feat: support customize styles and scripts #2229

Open fengzilong opened 3 years ago

fengzilong commented 3 years ago

比如在我们的使用场景中

  1. 需要给资源追加一些参数 ?xxx=yyy
  2. 改写 script 的执行逻辑,不会立马执行,等收到客户端消息再去执行主脚本
  3. 使用 <link rel="preload"> 等其他标签处理 styles/scripts

该 PR 支持了自定义 styles 和 scripts 处理逻辑,用法如下

import { Style, Script } from 'rax-document'

// for customize styles
<Style>
  {
    styles => {
      // do something with styles
    }
  }
</Style>

// for customize scripts
<Script>
  {
    scripts => {
      // do something with scripts
    }
  }
</Script>
SoloJiang commented 2 years ago

更新下版本和 changelog

fengzilong commented 2 years ago

更新下版本和 changelog

done

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.