stc

The fastest workflow

Usage no npm install needed!

<script type="module">
  import stc from 'https://cdn.skypack.dev/stc';
</script>

README

stc

高性能前端工作流系统

改进编译性能的几种方式

  • 充分利用多核 CPU
  • 基于 AST/Token
  • 分析依赖树
  • 无感知的缓存策略

工作流处理步骤

处理流程分为下面 4 个步骤,其中 lint,transpile 和 dependence 里的插件是并行处理,workflow 里的插件是串行处理。

  • lint - 代码规范检查,如:用 eslint 检查 JS 代码
  • transpile - 转译,将非标准的 HTML/JS/CSS 转换为标准的文件,如: TypeScript,Less,Sass
  • dependence - 依赖分析,workflow 里只处理被依赖的文件,提高编译性能
  • workflow - 内容替换等处理,如:压缩,上 CDN

配置文件示例

// stc.config.js

var stc = require('stc');
var uglify = require('stc-uglify');
var eslint = require('stc-eslint');

stc.config({
  include: ['template/', 'static/']
})

stc.lint({
    eslint: {plugin: eslint, include: /\.js$/, options: {}}
});

stc.workflow({
    uglify: {plugin: uglify, include: /\.js$/, options: {}}
});

stc.start(); // 启动工作流程

已经开发完成的插件

lint

transpile

dependence

workflow

需要开发的插件

  • 国际化
  • CSS Sprite
  • seajs 代码合并
  • 模板 XSS 自动修复功能
  • CDN 功能上传到阿里云、七牛、又拍云的适配器
  • Vue.js 代码转译
  • Weex 代码转译
  • 类似 webpack 将项目打包在一起的插件
  • fontello
  • jade 预编译
  • nunjucks 预编译

如何开发

如何开发?