stenciljs ionic 团队开发的方便web 组件框架

stenciljs 是ionic 团队开发的方便组件话开发的js 框架,具体以下特点

  • 简单,零配置,简单的api,typescript 支持
  • 性能,压缩之后6Kb,支持ssr,以及强大的原生web component 支持
  • 基于web 标准,同时方便的和ng ,vue ,react ,ember 集成

简单demo

  • 创建基本项目
 npm init stencil
  • 选择类型

    初始化可能有点慢

修改为如下:
"dependencies": {
"@stencil/core": "^0.13.0-14",
"@stencil/router": "^0.2.8",
"request": "^2.88.0"
}
更新 Stencil:
npm install @stencil/core@latest --save-exact
  • 安装依赖
yarn  or npm install 
  • 运行项目
yarn start or npm start
  • 效果

  • 构建生产可用版本
yarn build
  • 效果
    可以看到添加了google 的workbox 进行pwa 的支持



参考资料

https://stenciljs.com/docs/getting-started
https://github.com/ionic-team/stencil/issues/1106

posted on 2018-09-26 14:04  荣锋亮  阅读(934)  评论(0编辑  收藏  举报

导航