fd-gulp-dependencies
v0.0.1
Published
check amd dependencies base on gulp
Downloads
307
Maintainers
Readme
检查AMD模块依赖关系的gulp插件
用法
dependencies(baseDir, prefixDir, [opt]);
例子
var gulp = require('gulp');
var dependencies = require('fd-gulp-dependencies');
var dependencyOpt = {
"timeStamp": '2014_3_27_14_7_39',
"fileName": "amdVersion"
};
gulp.task('dependencies', function() {
return gulp.src(['./source/qingguo/**/*.js', '!./source/qingguo/**/tmp{,/**}', '!./source/qingguo/**/test{,/**}'])
.pipe(dependencies('./source/qingguo', 'app/qingguo', dependencyOpt))
.pipe(gulp.dest('./dest/version/'));
});
参数
baseDir string(必须)
要扫描的目录
prefixDir string(必须)
例如:app/search,app/qingguo,app/offer
opt object(可选)
* fileName 版本文件的名称,不设置,则不生成依赖关系文件,只扫描是否存在循环依赖。
* timeStamp 给文件名加个时间戳,例如2014_3_27_14_7_39,最终生成的依赖关系文件名称为:fileName-2014_3_27_14_7_39
生成的依赖关系内容大致如下:
/app/qingguo/js/amdtest/hello_world.js=app/qingguo/js/amdtest/output.js,app/qingguo/js/amdtest/hello.js,app/qingguo/js/amdtest/world.js,app/qingguo/js/amdtest/hello_world.js
/app/qingguo/js/amdtest/showtext.js=app/qingguo/js/amdtest/text.js,app/qingguo/js/amdtest/showtext.js
/app/qingguo/js/amdtest/slider.js=app/qingguo/js/amdtest/showtext.js,app/qingguo/js/amdtest/text.js,app/qingguo/js/amdtest/slider.js