Clear css file before building (#5108)

This commit is contained in:
Faris Ansari 2018-03-01 15:50:36 +05:30 committed by GitHub
parent e408de3abd
commit 57f621f1d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,13 +112,17 @@ function get_js_config(output_file, input_files) {
}
function get_css_config(output_file, input_files) {
const output_path = path.resolve(assets_path, output_file);
// clear css file to avoid appending problem
delete_file(output_path);
const plugins = [
// enables array of inputs
multi_entry(),
// less -> css
less({
output: path.resolve(assets_path, output_file),
output: output_path,
option: {
// so that other .less files can import variables.less from frappe directly
paths: [path.resolve(get_public_path('frappe'), 'less')],
@ -155,7 +159,7 @@ function ensure_js_css_dirs() {
const files = fs.readdirSync(css_path);
files.forEach(file => {
fs.unlinkSync(path.resolve(css_path, file));
delete_file(path.resolve(css_path, file));
});
}
@ -191,4 +195,10 @@ function get_build_json(app) {
}
}
function delete_file(path) {
if (fs.existsSync(path)) {
fs.unlinkSync(path);
}
}
module.exports = get_all_apps_config();