adf-bundle-collector
bundle collector of adf
Last updated 3 years ago by cleverchao .
UNLICENSED · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install adf-bundle-collector 
SYNC missed versions from official npm registry.

adf-bundle-collector

adf框架的插件收集器,负责收集并排序插件,最终导出资源排序后的数组

一个收集所有插件的js和css列表的应用如下

var log4js = require('log4js');
var ADF = require("adf-bundle-collector");

var logger = log4js.getLogger();
var bundlesRoot = path.join(__dirname, "src"); //插件的根目录
var adf = new ADF(bundlesRoot, logger);

var jsresourceFileList = [];
var cssresourceFileList = [];
module.exports = function(callback){
	adf.collect(function(error, bundleHolders){
        //bundleHolders 是所有插件的解析后对象
		bundleHolders.forEach(function(element) {
            //获取插件声明的js文件
			var resourceFiles = element.getAllResourceFiles();
			if(resourceFiles){
				resourceFiles.forEach(function(file) {
					jsresourceFileList.push(path.join(element.getName(), file));
				}, this);
			}
            //获取插件声明的css文件
			var css_files = element.getCss();
			if(css_files){
				css_files.forEach(function(file) {
					cssresourceFileList.push(path.join(element.getName(), file));
				}, this);
			}
		}, this);
	});
}

Current Tags

  • 0.1.3                                ...           latest (3 years ago)

4 Versions

  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |