function inject (opts) {
  var config = _.assign({
    cwd: undefined,
    module: undefined,
    outCSS: false
  }, opts);
  var fileMapJson = {
    dependency: {},
    include: {}
  };
  var modulePath = path.join(config.cwd, config.module);
  var mapJsonPath = path.join(modulePath, 'dist', 'map.json');
  var mapJson = JSON.parse(fs.readFileSync(mapJsonPath).toString());
  appConf = require(path.join(config.cwd, 'app-conf'));
  fileMapJson = _.assign(fileMapJson, mapJson);
  mapJSONCache[config.module] = mapJson;
  var exludeResourcePath = path.join(modulePath, 'dist', '_exlude_resource.json');
  exludeResource = Util.readJsonFile(exludeResourcePath);
  var outWidgets = [];
  if (config.outCSS) {
    var dependencyAll = mapJson.dependency;
    for (var i in dependencyAll) {
      if (Util.regexps.js.test(i)) {
        var tplname = path.basename(i, path.extname(i));
        outWidgets.push(tplname.replace('_tpl', ''));
        dependencyAll[i].forEach(function (widget) {
          var name = widget.widgetName;
          var index = outWidgets.indexOf(name);
          if (index < 0 && !widget.isCommon) {
            outWidgets.push(name);
          } else if (index >= 0 && widget.isCommon) {
            outWidgets.splice(index, 1);
          }
        });
      }
    }
  }
  ViewHelper.outWidgets = outWidgets;
  var stream = through2.obj(function (file, encoding, callback) {
    if (file.isNull() || file.isStream()) {
      return callback(null, file);
    }
    if (file.isBuffer()) {
      var fileString = generateFileHtml(file, config, fileMapJson);
      file.contents = new Buffer(fileString);
      this.push(file);
      callback();
    }
  }, function (callback) {
    var modulePath = path.join(config.cwd, config.module);
    var dest = path.join(modulePath, 'dist');
    if (!fs.existsSync(dest)) {
      fs.mkdirSync(dest);
    }
    fs.writeFileSync(path.join(dest, 'map.json'), JSON.stringify(fileMapJson, null, 2));
    callback();
  });
  return stream;
}