Skip to content

Instantly share code, notes, and snippets.

@cjsewell
Last active September 15, 2015 10:48
Show Gist options
  • Save cjsewell/deedba7269c532fc33fb to your computer and use it in GitHub Desktop.
Save cjsewell/deedba7269c532fc33fb to your computer and use it in GitHub Desktop.
Simple wrapper script to allow Netbeans to use node sass.
@ECHO OFF
SET RUBY="c:\tools\ruby200\bin\ruby.exe"
SET NODE=C:\ProgramData\chocolatey\bin\node.exe
SET RUBY_SASS="c:/tools/ruby200/bin/sass"
SET NODE_SASS=node_modules\node-sass\bin\node-sass
SET WT_SASS=wt.exe
SET ARG1=%1
SET ARG2=%2
SET ARG3=%3
SET ARG4=%4
SET ARG5=%5
SET ARG6=%6
SET ARG7=%7
SET ARG8=%8
SET ARG9=%9
SET All_ARGS=%*
SET All_ARGS=%*
SET WORKING_DIR=""
SET LAST=""
SET SECOND_LAST=""
SET USE_NODE_SASS=0
SET USE_WT_SASS=0
SHIFT & SHIFT
:LOOP
IF NOT "%1" == "" (
IF "%1" == "--nodesass" (
SET WORKING_DIR=%2
SET USE_NODE_SASS=1
SHIFT
)
IF "%1" == "--wt" (
SET WORKING_DIR=%2
SET USE_WT_SASS=1
SHIFT
)
SHIFT
GOTO :LOOP
)
CALL :FIND_LAST %*
GOTO :START
:FIND_LAST
IF NOT "%1"=="" (
SET SECOND_LAST=%LAST%
SET LAST=%~1
)
SHIFT
IF NOT "%1"=="" GOTO FIND_LAST
GOTO :EOF
:START
IF "%USE_NODE_SASS%" == "1" GOTO :NodeSass
IF "%USE_WT_SASS%" == "1" GOTO :WTSass
IF NOT "%~f0" == "~f0" GOTO :WinNT
@%RUBY% %RUBY_SASS% %ARG1% %ARG2% %ARG3% %ARG4% %ARG5% %ARG6% %ARG7% %ARG8% %ARG9%
GOTO :EOF
:WinNT
@%RUBY% "%~dpn0" %All_ARGS%
GOTO :EOF
:NodeSass
CD %WORKING_DIR%
IF exist %CD%\bower_components (
SET INCLUDES=--include-path=%WORKING_DIR%\bower_components
)
call %NODE% %NODE_SASS% %INCLUDES% --quiet --source-map=true --output-style=compressed %SECOND_LAST% %LAST%
GOTO :EOF
:WTSass
CD %WORKING_DIR%
IF exist %CD%\bower_components (
SET INCLUDES=--include-path=%WORKING_DIR%\bower_components
)
%WT_SASS% %INCLUDES% --quiet --source-map=true --output-style=compressed %SECOND_LAST% %LAST%
GOTO :EOF
:EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment