-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.py
49 lines (36 loc) · 1.3 KB
/
dev.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import argparse, shutil, os
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
parser = argparse.ArgumentParser(description='Some scripts for packed')
parser.add_argument('--scss', '-c', '--css', action='store_true', help='compile scss to css')
parser.add_argument('--js', '-c', '--css', action='store_true', help='compile ts to js')
parser.add_argument('--csswatch', '-w', action='store_true', help='watch css')
parser.add_argument('--ts', '-t', action='store_true', help='watch ts')
args = parser.parse_args()
if args.scss:
cmds = [
'sass static/index.scss static/index.css'
]
for cmd in cmds:
print(f'Compiling {cmd.split(" ")[1]}')
os.system(cmd)
if args.js:
cmds = [
'tsc static/index.ts'
]
for cmd in cmds:
print(f'Compiling {cmd.split(" ")[1]}')
os.system(cmd)
if args.csswatch:
cmds = [
'sass --watch static/index.scss static/index.css'
]
for cmd in cmds:
print(f'Watching {cmd.split(" ")[2]}')
os.system(cmd)
if args.ts:
#get all ts files in public/ts
ts_files = [f for f in os.listdir('static') if f.endswith('.ts')]
#listen for chasnges in all ts files
for ts_file in ts_files:
os.system(f'tsc -w static/{ts_file} --outDir static')