fix: simplify type flag logic

This commit is contained in:
ndom91 2021-09-05 00:27:30 +02:00 committed by thatmattlove
parent c3fa59312c
commit 9a51849012

View File

@ -6,10 +6,7 @@ const tsWatcher = chokidar.watch('src/**/*.ts');
const collectStatic = type => { const collectStatic = type => {
console.log('[*] bundling..'); console.log('[*] bundling..');
let args = ''; execSync(`node bundle.js ${type && `--${type}`}`);
if (type === 'style') args += '--styles';
if (type === 'script') args += '--scripts';
execSync(`node bundle.js ${args}`);
console.log('[*] collecting..'); console.log('[*] collecting..');
exec('../../venv/bin/python3 ../manage.py collectstatic --no-input', (err, stdout, stderr) => { exec('../../venv/bin/python3 ../manage.py collectstatic --no-input', (err, stdout, stderr) => {
@ -22,10 +19,10 @@ const collectStatic = type => {
sassWatcher.on('change', path => { sassWatcher.on('change', path => {
console.log(`[*] '${path}' has changed`); console.log(`[*] '${path}' has changed`);
collectStatic('style'); collectStatic('styles');
}); });
tsWatcher.on('change', path => { tsWatcher.on('change', path => {
console.log(`[*] '${path}' has changed`); console.log(`[*] '${path}' has changed`);
collectStatic('script'); collectStatic('scripts');
}); });