07-23-2023, 05:24 AM
In web projects on my local machine, I'm using a fairly simple Sass setup.
In the same folder, I have /scss/style.scss and /css/style.css
So to run Sass while I work I just write this in a Ruby Terminal:
cd "C:\Users\Puppybeard\Documents\Aptana Studio 3 Workspace\Project Title"
sass --watch scss/style.scss:css/style.css
Works fine, but it's a little cumbersome, so I'm trying to figure out how to do the equivalent with a batch script.
I've tried the following, but it's a complete disaster, and my computer tries to open an infinite amount of Ruby consoles.
cd "C:\Ruby193\bin"
start ruby
cd "C:\Users\Puppybeard\Documents\Aptana Studio 3 Workspace\Project Title"
sass --watch scss/style.scss:css/style.css
exit
I think what I need to do is to start Ruby running in the background, rather than open the Ruby exe. Does anyone know how, or is that even how Ruby works? Obviously, I'm new to Sass, Ruby and batch scripts, so any insight you can give me would be a big help, thanks.
---------------------
EDIT: I got it working like this
cd "\Ruby193\bin"
sass --watch "C:\Users\Puppybeard\Documents\Aptana Studio 3 Workspace\Project Title\scss\style.scss:C:\Users\Puppybeard\Documents\Aptana Studio 3 Workspace\Project Title\css\style.css"
I think it should be neater, and suspect that sass needs to have it's $PATH set.
----------------------
EDIT 2: I set the Path variable for Ruby, using these instructions:
In my case, the path I needed to add was C:\Ruby193\bin
Now the only line I need, when I have the script in the root of the web project, is:
> sass --watch scss/style.scss:css/style.css
I could keep the part where I change directory to the location of the folders in if I wanted to have something that can run from anywhere on my computer. However, the fact that the script doesn't specify the project location means I can just copy it into any project where I use the same structure.
Worth the effort? In the long run, probably, yeah.
In the same folder, I have /scss/style.scss and /css/style.css
So to run Sass while I work I just write this in a Ruby Terminal:
cd "C:\Users\Puppybeard\Documents\Aptana Studio 3 Workspace\Project Title"
sass --watch scss/style.scss:css/style.css
Works fine, but it's a little cumbersome, so I'm trying to figure out how to do the equivalent with a batch script.
I've tried the following, but it's a complete disaster, and my computer tries to open an infinite amount of Ruby consoles.
cd "C:\Ruby193\bin"
start ruby
cd "C:\Users\Puppybeard\Documents\Aptana Studio 3 Workspace\Project Title"
sass --watch scss/style.scss:css/style.css
exit
I think what I need to do is to start Ruby running in the background, rather than open the Ruby exe. Does anyone know how, or is that even how Ruby works? Obviously, I'm new to Sass, Ruby and batch scripts, so any insight you can give me would be a big help, thanks.
---------------------
EDIT: I got it working like this
cd "\Ruby193\bin"
sass --watch "C:\Users\Puppybeard\Documents\Aptana Studio 3 Workspace\Project Title\scss\style.scss:C:\Users\Puppybeard\Documents\Aptana Studio 3 Workspace\Project Title\css\style.css"
I think it should be neater, and suspect that sass needs to have it's $PATH set.
----------------------
EDIT 2: I set the Path variable for Ruby, using these instructions:
[To see links please register here]
In my case, the path I needed to add was C:\Ruby193\bin
Now the only line I need, when I have the script in the root of the web project, is:
> sass --watch scss/style.scss:css/style.css
I could keep the part where I change directory to the location of the folders in if I wanted to have something that can run from anywhere on my computer. However, the fact that the script doesn't specify the project location means I can just copy it into any project where I use the same structure.
Worth the effort? In the long run, probably, yeah.