UNPKG

shaman-website-compiler

Version:

Compile raw HTML, CSS and Javascript into the smallest possible, SEO friendly website.

45 lines 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateScript = exports.CreateStyle = exports.CreateMinifiedBundleTags = exports.CreateBundleTags = void 0; function CreateBundleTags(bundles) { return bundles .map(function (bundle) { if (bundle.type == 'css') { return bundle.files.map(function (file) { return CreateStyle(file); }); } else { return bundle.files.map(function (file) { return CreateScript(file); }); } }) .reduce(function (a, b) { return a.concat(b); }, []) .reduce(function (a, b) { return "".concat(a).concat(a == '' ? '' : '\r\n').concat(b); }, ''); } exports.CreateBundleTags = CreateBundleTags; function CreateMinifiedBundleTags(bundles) { return bundles .map(function (bundle) { if (bundle.type == 'css') { return "".concat(CreateStyle("".concat(bundle.name, ".min.css"))); } else { return "".concat(CreateScript("".concat(bundle.name, ".min.js"))); } }) .reduce(function (a, b) { return "".concat(a).concat(a == '' ? '' : '\r\n').concat(b); }, ''); } exports.CreateMinifiedBundleTags = CreateMinifiedBundleTags; function CreateStyle(path) { return "<link rel=\"stylesheet\" type=\"text/css\" href=\"/".concat(path, "\">"); } exports.CreateStyle = CreateStyle; function CreateScript(path) { return "<script type=\"text/javascript\" src=\"/".concat(path, "\"></script>"); } exports.CreateScript = CreateScript; //# sourceMappingURL=handlebars.functions.js.map