docs: function (htmlpath, projectRoot, pageName, scriptmain, baseurl, publishroot) {
      var scriptName = htmlpath.replace(path.join(cwd, 'pages/'), '').replace(cwd, '').replace(path.extname(htmlpath), '').replace(/\/|\\/g, '_');
      var scriptDir = path.dirname(htmlpath);
      var config = require('../index').getConfig();
      var httpReg = /(http:\/\/.+:[\d]+)|(https:\/\/.+:[\d]+)/;
      var fileReg = /file:[/]+/;
      if (httpReg.test(config.base)) {
          config.base = config.base.replace(httpReg, cwd);
      }
      if (fileReg.test(config.base)) {
          config.base = config.base.replace(fileReg, '');
      }
      if (/^\//.test(scriptmain)) { //以 / 开头的路径，指向项目的根路径，不应指向盘符的根
          scriptmain = path.resolve(cwd, '.' + scriptmain);
      }
      defineMd5 = require('jspacker').pack(
          path.resolve(scriptDir, scriptmain),
          projectRoot + '/scripts',
          pageName,
          cwd,
          config
      );
      var jsfilePath = path.resolve(cwd, projectRoot + '/scripts/' + pageName + '.js');
      var jscode = fs.readFileSync(jsfilePath, 'utf-8');
      jscode = jscode.replace(require('./link').reg, function (m) {//处理js中出现的img标签
          require('./link').preReplace(m, htmlpath, projectRoot, pageName, baseurl, publishroot, true);
          return '';
      });
      fs.writeFileSync(path.resolve(cwd, projectRoot + '/scripts/' + scriptName + '.js'), jscode);
      shell.rm('-rf', path.resolve(cwd, projectRoot + '/scripts/' + pageName + '.js'));
      var jsMinfilePath = path.resolve(cwd, projectRoot + '/scripts/' + pageName + '-min.js');
      var jsmincode = fs.readFileSync(jsMinfilePath, 'utf-8');
      jsmincode = jsmincode.replace(require('./img').reg, function (m) {//处理js中出现的img标签
          return require('./img').replace(m, htmlpath, projectRoot, pageName, baseurl, publishroot, true);
      });
      jsmincode = jsmincode.replace(require('./link').reg, function (m) {//处理js中出现的link标签
          return '';
      });
      md5 = crypto.createHash('md5');
      var jsMd5 = md5.update(jsmincode)
          .digest('hex')
          .substring(0, 6);
      shell.rm('-rf', jsMinfilePath);
      if (baseurl === config.serverUrl) { //发布到服务器阶段，删除未压缩的文件
          shell.rm('-rf', path.resolve(cwd, projectRoot + '/scripts/' + scriptName + '.js'));
      }
      fs.writeFileSync(path.resolve(cwd, projectRoot + '/scripts/js_' + jsMd5 + '.js'), jsmincode);
      return jsMd5;
  }