UNPKG

ap-ssg

Version:

A fast, modular, SEO-optimized static site generator that minifies CSS, JS, and HTML for improved performance. It also supports JSON-LD, sitemap generation, and more, making it ideal for production-ready websites.

21 lines (17 loc) 784 B
const path = require("path"); const { getBuildDirPath } = require("../configs/paths"); const ensureValidHtmlPath = require("./ensureValidHtmlPath"); /** * Generates the build file path based on the provided filePath. * The filePath can optionally include a `.html` extension. * * @param {string} filePath - The file path to process. * @returns {string} - The full path to the file in the 'build' directory. * @throws {Error} - If filePath is empty or contains invalid characters. */ function getBuildFilePath(filePath) { if (!filePath) throw new Error("filePath is required to generate file."); // Generate and return the full build file path return path.join(getBuildDirPath(), ensureValidHtmlPath(filePath)); } module.exports = getBuildFilePath;