svb
Version:
📦 A zero-config CLI to bundle Svelte apps
24 lines (21 loc) • 478 B
JavaScript
// Utils
const { read } = require('../../utils/fs.js');
/**
* Actually reads the contents of a given HTML template file.
* Like utils.read but with different outputs
*
* @param {string} path Absolute path to the HTML template file
*/
const readTemplate = async (path) => {
try {
return {
contents: await read(path),
fileName: path.split(path.sep).pop(),
};
} catch (error) {
return {
error,
};
}
};
module.exports = readTemplate;