* Better rollup messages in console * Remove 'docs folder not found' warning * Show production message * fix codacy
26 lines
No EOL
591 B
JavaScript
26 lines
No EOL
591 B
JavaScript
const path = require('path');
|
|
|
|
function scrub_html_template(content) {
|
|
content = content.replace(/\s/g, ' ');
|
|
content = content.replace(/(<!--.*?-->)/g, '');
|
|
return content.replace("'", "\'"); // eslint-disable-line
|
|
}
|
|
|
|
module.exports = function frappe_html() {
|
|
return {
|
|
name: 'frappe-html',
|
|
transform(code, id) {
|
|
if (!id.endsWith('.html')) return null;
|
|
|
|
var filepath = path.basename(id).split('.');
|
|
filepath.splice(-1);
|
|
|
|
var key = filepath.join(".");
|
|
var content = scrub_html_template(code);
|
|
|
|
return `
|
|
frappe.templates['${key}'] = '${content}';
|
|
`;
|
|
}
|
|
};
|
|
}; |