UNPKG

honkit

Version:

HonKit is building beautiful books using Markdown.

30 lines (28 loc) 1.34 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const resolveImages_1 = __importDefault(require("./resolveImages")); const fetchRemoteImages_1 = __importDefault(require("./fetchRemoteImages")); const svgToImg_1 = __importDefault(require("./svgToImg")); const inlineSvg_1 = __importDefault(require("./inlineSvg")); const inlinePng_1 = __importDefault(require("./inlinePng")); const promise_1 = __importDefault(require("../../utils/promise")); /** Inline all assets in a page @param {string} rootFolder */ function inlineAssets(rootFolder, currentFile) { return function ($) { return ((0, promise_1.default)() // Resolving images and fetching external images should be // done before svg conversion .then(resolveImages_1.default.bind(null, currentFile, $)) .then(fetchRemoteImages_1.default.bind(null, rootFolder, currentFile, $)) .then(svgToImg_1.default.bind(null, rootFolder, currentFile, $)) .then(inlineSvg_1.default.bind(null, rootFolder, currentFile, $)) .then(inlinePng_1.default.bind(null, rootFolder, currentFile, $))); }; } exports.default = inlineAssets;