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