mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-03 12:48:45 +08:00
17 lines
394 B
JavaScript
17 lines
394 B
JavaScript
|
const path = require('path');
|
||
|
const templates = path.resolve(process.cwd(), './examples/pages/template');
|
||
|
|
||
|
const chokidar = require('chokidar');
|
||
|
let watcher = chokidar.watch([templates]);
|
||
|
|
||
|
watcher.on('ready', function() {
|
||
|
watcher
|
||
|
.on('change', function() {
|
||
|
exec('npm run i18n');
|
||
|
});
|
||
|
});
|
||
|
|
||
|
function exec(cmd) {
|
||
|
return require('child_process').execSync(cmd).toString().trim();
|
||
|
}
|