Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 283 Vote(s) - 3.56 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I use Sass with a batch script in Windows

#1
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:

[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.

Reply

#2
**If you're trying to update multiple css files with a batch file** like this:

scss A.scss ../CSS/A.css
scss B.scss ../CSS/B.css
echo Done.

...but only the first scss command line executes, and the batch file never completes, i.e. you never see the 'Done.', here is why and how to fix it:

scss is actually a buggy batch file that fails to return control to your batch file. I fixed this by bypassing the scss batch file and runing ruby and it's scss gem directly as follows:

ruby C:/Ruby193/bin/scss A.scss ../CSS/A.css
ruby C:/Ruby193/bin/scss B.scss ../CSS/B.css
echo Done.

You'll need to have your path pointed to ruby, or put an absolute path in above.
Reply

#3
Put your original two commands into your batch file. So the content of the .bat file would be:

cd "C:\Users\Puppybeard\Documents\Aptana Studio 3 Workspace\Project Title"
sass --watch scss/style.scss:css/style.css

Simple as that. A batch file like this runs each command on each line one after the other, as if you were typing each one individually.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through