gpreview
Version:
Preview Ghost themes locally without a full Ghost installation
19 lines • 743 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.assetHelper = assetHelper;
const handlebars_1 = __importDefault(require("handlebars"));
function assetHelper(path, _options) {
if (!path) {
throw new Error('{{asset}} helper must be passed a path');
}
let cleanPath = path.startsWith('/') ? path.substring(1) : path;
if (cleanPath.startsWith('assets/')) {
cleanPath = cleanPath.substring(7);
}
const assetPath = `/assets/${cleanPath}`;
return new handlebars_1.default.SafeString(assetPath);
}
//# sourceMappingURL=asset.js.map