code: function uniqueResource(file, resource, opts) {
    var ld = fis.util.escapeReg(opts.left_delimiter);
    var rd = fis.util.escapeReg(opts.right_delimiter);
    var rInclude = new RegExp(ld + '(extends|include).*?\\bfile=(\'|")(.+?)\\2.*?' + rd, 'ig');
    var content = file.getContent();
  
    content.replace(rInclude, function(all, type, quote, target) {
      var info = fis.project.lookup(target, file);
      var layout;
      if (!info.file || !(layout = resource.getFileById(info.id))) {
        return;
      }
  
      process._compile(layout);
      file._tplIncludes = file._tplIncludes || [];
      file._tplIncludes.push(layout);
    });
  
    // 去重所有带 id 信息的资源。
    (function(file) {
      if (!file._tplIncludes)return;
      var fn = arguments.callee;
  
      file._tplIncludes.forEach(function(layout) {
        fn(layout);
  
        layout._resource.res.forEach(function(item) {
          item.id && resource.remove(item.id, item.async);
        });
      });
    })(file);
  }
docs: /*
  去重资源。