-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwatch.cmd
29 lines (23 loc) · 1.03 KB
/
watch.cmd
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
@ECHO OFF
REM Builds css files by sassc and generates static html site.
REM
REM Created by Alexander Borsuk <[email protected]> from Minsk, Belarus.
SETLOCAL
REM Use PHP binary from the PATH.
SET php=php.exe
for %%f in (bin\sassc*%PROCESSOR_ARCHITECTURE%.exe) do SET sassc=%%f
for %%f in (bin\*fswatch*%PROCESSOR_ARCHITECTURE%.exe) do SET fswatch=%%f
SET sassc_input=scss/style.scss
SET sassc_output=www/css/style.css
REM One of: nested, expanded, compact, compressed
SET sassc_style=nested
SET watch_directory=scss
REM Launch local php web server in background.
START "" /B %php% -S localhost:8888 -t www || ECHO ERROR while launching %php% web server. && EXIT /B 1
REM Rebuild scss on the launch once and watch for any scss directory changes indefinitely.
:loop
ECHO Rebuilding %sassc_output%
REM Do not stop after sassc returned error, because it can be caused by invalid scss syntax.
%sassc% --style %sassc_style% %sassc_input% %sassc_output%
%fswatch% --one-event %watch_directory% || ECHO ERROR while launching %fswatch%. && EXIT /B 1
GOTO loop