ilivewithian
ilivewithian

Reputation: 19692

sass watch files in folder and minify, but control output filename

I know that I can watch a single file in a folder and have it compressed like so:

sass --watch HealthyArticles.scss:HealthyArticles.min.css --style compressed

What I'd like to be able to do is:

sass --watch *.scss:*.min.css --style compressed

The problem with this is that I get the error:

Errno::EINVAL: Invalid argument - *.scss

The main point is controlling the output filename. Is this possible with sass?

Upvotes: 3

Views: 3256

Answers (1)

iHiD
iHiD

Reputation: 2438

I think you're probably looking for Compass. All this stuff is just baked into Rails, so I'm not sure exactly how everything links together, but I believe if you're using SCSS without a framework around it, then Compass is what you're after.

Download from http://compass-style.org/ and run something like this:

gem install compass 
$ compass create asd --bare --sass-dir "input_directory" --css-dir "output_directory"

You can set this in a config file:

output_style = :compressed

Alternatively, you could just run a script that does something like (this is Ruby):

files = Dir["/path/to/scss/folder/*.scss"].map do |file|
  "#{file}:#{file.gsub(".scss", ".min.css")}"
end
`sass --watch #{files} --style compressed`

Upvotes: 2

Related Questions