тему можно закрывать...
var fs = require('fs');
var jsdom = require('jsdom');
function homePage() {
var header = fs.readFileSync('./dist/html/header.html').toString();
var homepage = fs.readFileSync('./dist/html/homepage.html').toString();
fs.readFile('./dist/html/main.html', function(err, data) {
var dataString = data.toString();
jsdom.env(dataString, [], function(err, window){
var $ = require("jquery")(window);
$('body').append(header);
$('body').append(homepage);
$('body').addClass('mainPageBody');
$('html').addClass('mainPageHtml');
$('title').html("Home Page");
$('body').append('<script src=../js/concatedJS/concated.js></script>');
var doubleScriptHtml = window.document.documentElement.outerHTML
var oneScriptHtml = doubleScriptHtml.replace(/<script src="\.\.\/js\/concatedJS\/concated\.js\"><\/script>/,'')
fs.writeFileSync('./dist/html/test.html','<!DOCTYPE html>'+ oneScriptHtml);
});
});
};