* JS build working * Css build working! * Uglify JS in production * fix codacy * Add frappe.commands.popen * FIx ESLint errors * Add socket.io to package.json * ignore subprocess warnings * Add babel-runtime * sleep 20 after bench start * remove set -e * [FIX] non-shell subprocess call * [FIX] use shell = False * split commands
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}';
|
|
`;
|
|
}
|
|
};
|
|
}; |