gulp-seajs-trs
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -47,3 +47,3 @@ var es = require('event-stream'); | ||
// 发布后的地址 | ||
var baseOnlinePath = config.paths[packageName] = resolvePath(config.base + '/' + config.name + '/' + config.version); | ||
var baseOnlinePath = config.paths[packageName] = config.paths[packageName] || resolvePath(config.base + '/' + config.name + '/' + config.version); | ||
function resolvePath (dir) { | ||
@@ -50,0 +50,0 @@ if (!dir) {return} |
{ | ||
"name": "gulp-seajs-trs", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "An seajs transport plugin ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
126
README.md
@@ -1,101 +0,39 @@ | ||
# Seajs transport plugin | ||
# 使用说明 | ||
## What's this? | ||
## 配置参数 | ||
This is a plugin for transport local file. | ||
## config | ||
```json | ||
{ | ||
// base path for this package | ||
"group": 'http://cdn.com/pkg/', | ||
// if you want some alias name for paths config you can set this | ||
"rename": 'mod_name', | ||
// charset | ||
"charset":"utf-8", | ||
// use debug mode for seajs | ||
"debug": false, | ||
// current version | ||
"version": '1.2.1', | ||
// the mapfile name | ||
"depsFile": "map.js", | ||
// ignore some files also support "./**/*.tpl.js" or ["./**/*.xx"] | ||
"ignore":"common/lib/seed.js", | ||
// seajs alias config | ||
"alias": { | ||
// support dir for seajs "mod":"alias_name/mod/", or | ||
"mod":"alias_name/mod", | ||
"zepto": "http://cdn.com/lib/zepto.js", | ||
"gesture": "my/ui/event/gesture.js" | ||
}, | ||
// seajs paths config | ||
"paths": { | ||
'my': 'http://cdn.com/my/' | ||
}, | ||
// use anonymous default is false | ||
// if you want an anoymous module, why you use this? | ||
"anonymous": false | ||
// 别名的文件或者文件夹,文件夹以 /结尾 以文件夹名称开始 | ||
// 例如: common/widgets/slider/ | ||
alias: {}, | ||
// 路径别名,用以控制线上文件路径 如未设置当前模块,则按照 | ||
// `{base}/{name}/{version}/` 格式进行拼接 | ||
// 拼接最终配置无`http(s):` | ||
paths: {}, | ||
// 依赖关系拓扑,用于动态combo | ||
combo: {}, | ||
// 基础路径地址。 | ||
base: 'https://g.alicdn.com/ju/', | ||
// 是否生成map.js 如果不需要,可配置false | ||
mapfile: 'map.js', | ||
// 根目录,绝对路径 | ||
rootdir: rootdir+'/src/', | ||
// 当前包名 | ||
// 用于网络请求 | ||
name: '', | ||
// 用于定义包 | ||
rename: '', | ||
// 版本设置 | ||
version: '0.0.0', | ||
// 编码设置 | ||
charset: 'utf-8', | ||
// 忽略部分文件,防止二次编译等问题 | ||
ignore: [], | ||
// 是否匿名包,默认是false | ||
anonymous: false | ||
} | ||
``` | ||
<font color="#c00">Notice:</font> | ||
> Please write code with out `define`.But this plugin support auto resolve define as default. | ||
The follow example | ||
The input | ||
```javascript | ||
// basedir /src/ | ||
// /src/common/lib/seed.js | ||
(function (global) {global.seajs={version:"1.1.0"};})(this); | ||
// /src/mod/a.js | ||
exports.name = 'a'; | ||
// /src/mod/b.js | ||
exports.version = '1.0.0'; | ||
exports.a = require('./a.js'); | ||
exports.$ = require('zepto'); | ||
exports.gesture = require('gesture'); | ||
``` | ||
The output | ||
```javascript | ||
// output | ||
// /src/common/lib/seed.js | ||
(function (global) {global.seajs={version:"1.1.0"};})(this); | ||
// /src/mod/a.js | ||
define('alias_name/mod/a.js',function (require, exports, module) { | ||
exports.name = 'a'; | ||
}); | ||
// /src/mod/b.js | ||
define('alias_name/mod/b.js',['alias_name/mod/a.js','zepto','gesture'],function (require, exports, module) { | ||
exports.version = '1.0.0'; | ||
exports.a = require('./a.js'); | ||
exports.$ = require('zepto'); | ||
exports.gesture = require('gesture'); | ||
}); | ||
// map.js | ||
seajs.config({ | ||
base: 'http://cdn.com/pkg/', | ||
alias: { | ||
"mod/a.js":"alias_name/mod/a.js", | ||
"zepto": "http://cdn.com/lib/zepto.js", | ||
"gesture": "my/ui/event/gesture.js" | ||
}, | ||
paths:{ | ||
'my': 'http://cdn.com/pkg/my/1.2.1', | ||
'alias_name': 'http://cdn.com/pkg/mod_name' | ||
}, | ||
charset: "utf-8", | ||
debug: false | ||
}); | ||
``` | ||
<font color="#c00">建议:</font> | ||
> 建议使用和nodejs风格统一的编码方式,无需define,当然,写了define的话也不会有问题~ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
12316
40