|
@@ -1,41 +1,47 @@
|
|
|
const fs = require('fs');
|
|
const fs = require('fs');
|
|
|
-const { exec } = require('child_process');
|
|
|
|
|
|
|
+const {exec} = require('child_process');
|
|
|
|
|
|
|
|
// this is for fix because the event fire twice
|
|
// this is for fix because the event fire twice
|
|
|
let twiceFix = false;
|
|
let twiceFix = false;
|
|
|
|
|
|
|
|
function compileAll(event, fname) {
|
|
function compileAll(event, fname) {
|
|
|
console.log(`${fname} as changed`);
|
|
console.log(`${fname} as changed`);
|
|
|
- if(event == 'change' && twiceFix) {
|
|
|
|
|
|
|
+ if (event == 'change' && twiceFix) {
|
|
|
twiceFix = false;
|
|
twiceFix = false;
|
|
|
- exec('sass ui/css/omlink.scss:ui/css/omlink.css', (error, out, err) => {
|
|
|
|
|
- console.log('------------------------------ compileAll() ------------------------------');
|
|
|
|
|
- if(error) {
|
|
|
|
|
|
|
+ exec('npx sass ui/css/omlink.scss:ui/css/omlink.css', (error, out, err) => {
|
|
|
|
|
+ console.log('------------------------------ CSS built ------------------------------');
|
|
|
|
|
+ if (error) {
|
|
|
console.log(error);
|
|
console.log(error);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- exec('npm run build dimatec');
|
|
|
|
|
|
|
+ exec('npm run build', (error, out, err) => {
|
|
|
|
|
+ console.log('------------------------------ Bundle JS/CSS ------------------------------');
|
|
|
|
|
+ if (error) {
|
|
|
|
|
+ console.log(error);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
twiceFix = true;
|
|
twiceFix = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
console.log('Adding watcher for ui/css/omlink.scss');
|
|
console.log('Adding watcher for ui/css/omlink.scss');
|
|
|
-fs.watch('ui/css/omlink.scss', function(event, fname) {
|
|
|
|
|
|
|
+fs.watch('ui/css/omlink.scss', function (event, fname) {
|
|
|
compileAll(event, fname);
|
|
compileAll(event, fname);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
console.log('Adding watcher for ui/customizations/dimatec.scss');
|
|
console.log('Adding watcher for ui/customizations/dimatec.scss');
|
|
|
-fs.watch('ui/customizations/dimatec.scss', function(event, fname) {
|
|
|
|
|
|
|
+fs.watch('ui/customizations/dimatec.scss', function (event, fname) {
|
|
|
compileAll(event, fname);
|
|
compileAll(event, fname);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
console.log('Adding watcher for ui/customizations/lamborghini.scss');
|
|
console.log('Adding watcher for ui/customizations/lamborghini.scss');
|
|
|
-fs.watch('ui/customizations/lamborghini.scss', function(event, fname) {
|
|
|
|
|
|
|
+fs.watch('ui/customizations/lamborghini.scss', function (event, fname) {
|
|
|
compileAll(event, fname);
|
|
compileAll(event, fname);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
console.log('Adding watcher for ui/js/onlink.js');
|
|
console.log('Adding watcher for ui/js/onlink.js');
|
|
|
-fs.watch('ui/js/omlink.js', function(event, fname) {
|
|
|
|
|
|
|
+fs.watch('ui/js/omlink.js', function (event, fname) {
|
|
|
compileAll(event, fname);
|
|
compileAll(event, fname);
|
|
|
});
|
|
});
|