利用注释处理 html 长字符串模板小技巧:

var htmlTemplate = function(){/*
  <html>
    <head></head>
    <body>
      <div class="g">
        <ul class="ulClass">
          <li class="random"></li>
          <li class="random"></li>
          <li class="random"></li>					
        </ul>
      </div>
    </body>
  </html>
*/};

// extract html from comment
var beginBrace = /function\s*?\(\s*?\)\{\/\*/;
var endBrace = /\*\//;
html = htmlTemplate.toString().replace(beginBrace, '').replace(endBrace, '');

// replace variables
html = html.replace(//g, 'rd_val_01');
html = html.replace(//g, 'rd_val_02');
html = html.replace(//g, 'rd_val_03');

console.log(html);