1.10.3 • Published 3 years ago

makit-plugin v1.10.3

Weekly downloads
13
License
MIT
Repository
github
Last release
3 years ago

makit-plugin

Language Build Status Coveralls npm package npm downloads semantic-release

makit-plugin

Install

npm i makit-plugin --save-dev

Get Start

makit-plugin 为基于 makit 的构建项目提供plugin的recipe封装,适用于中大型项目构建;同时提供部分必要的plugin(暂时性)。

RecipeFactory && recipeImpl

参数传递 可以通过RecipeFactory向recipeImpl传递一些参数,避免在repice中耦合业务代码

const comp = process.env.compress;

const recipe = RecipeFactory(recipeImpl, {key: '$1'});

rule(`(**/*).min.js`, `/$1.js`, RecipeFactory(recipeImpl, {
    comp,
}));

function recipeImpl({target, dep, comp}) {}

反向引用 可以在recipeImpl的options中的字符串参数中引用rule匹配到的字符串($0~$9)

const recipe = RecipeFactory(recipeImpl, {key: '$1'});

rule(`(**/*).min.js`, `/$1.js`, recipe);

function recipeImpl({target, dep, key}) {
    // target   frame.min.js
    // dep      frame.js
    // key      frame
}

配置 RecipeFactory可以接受一个配置集合,当recipeImpl执行前,符合target的配置会被选中,将传给recipeImpl。这样,recipe可以实现一些文件粒度的差异化配置

const configs = [{
    file: 'static/**.js',
    compress: true
}, {
    file: 'static/**.min.js',
    compress: false
}];

const recipe = RecipeFactory(recipeImpl, {key: '$1', ...dynamicOption}, configs);

rule(`(**/*).js`, `${src}/$1.js`, recipe);

recipe

compress

css

hash

inline-js

map

parse-js

san

tpl

wrap

deploy

utils

async-replace

entry

API

API DOC

1.10.3

3 years ago

1.10.2

4 years ago

1.10.1

4 years ago

1.10.0

4 years ago

1.9.2

4 years ago

1.9.1

4 years ago

1.9.0

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago