3.2.7 • Published 6 years ago

gulp-msapp-comps v3.2.7

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

gulp-msapp-comps

检测小程序 page 页面中依赖的自定义组件,自动加载到项目中

Install

npm install gulp-msapp-comps --save-dev

Usage

var gulp = require("gulp")
var compsRequire = require("gulp-msapp-comps")

gulp.task("release", function() {
    gulp.src(["src/**/*"])
    .pipe(gulp.dest("./dist"))
    .pipe(compsRequire())
    .pipe(gulp.dest("./dist"))
})

小程序page页面的 json 配置只需要这样引用, tvideo 是外部的一个自定义组件,插件会将这个外部的自定义组件加载进项目中,并修改 json 配置的路径引用

{
    "usingComponents": {
        "t-video": "tvideo/index"
    }
}

API

compsRequire(options)

options.src

自定义组件存放的源目录

Type: String Default: path.resolve(process.cwd(), "./components")

options.dist

自定义组件存放的目标目录

Type: String Default: path.resolve(process.cwd(), "./dist/components/")

options.output

自定义组件引用的公共库存放的目标目录

Type: String

options.resolve

自定义组件内部可以通过 resolve 配置依赖

Type: Object

FieldDefaultDescription
alias[]A list of module alias configurations or an object which maps key to value
aliasFields[]A list of alias fields in description files
cacheWithContexttrueIf unsafe cache is enabled, includes request.context in the cache key
descriptionFiles"package.json"A list of description files to read from
enforceExtensionfalseEnforce that a extension from extensions must be used
enforceModuleExtensionfalseEnforce that a extension from moduleExtensions must be used
extensions".js", ".json", ".node"A list of extensions which should be tried for files
mainFields"main"A list of main fields in description files
mainFiles"index"A list of main files in directories
modules"node_modules"A list of directories to resolve modules from, can be absolute path or folder name
unsafeCachefalseUse this cache object to unsafely cache the successful requests
plugins[]A list of additional resolve plugins which should be applied
symlinkstrueWhether to resolve symlinks to their symlinked location
cachePredicatefunction() { return true };A function which decides whether a request should be cached or not. An object is passed to the function with path and request properties.
moduleExtensions[]A list of module extensions which should be tried for modules
resolveToContextfalseResolve to a context instead of a file
fileSystemThe file system which should be used
resolverundefinedA prepared Resolver to which the plugins are attached
3.2.7

6 years ago

3.2.6

6 years ago

3.2.5

6 years ago

3.2.4

6 years ago

3.2.3

6 years ago

3.2.2

6 years ago

3.1.2

6 years ago

3.1.1

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago