Developer
Developer

Reputation: 1437

how do i convert hundreds of CSS file to SCSS files?

I have existing project which is being used 300 css files and now the requirement is to convert it from css to SCSS.

Requesting your help on this, if some one shed some light it will be great full..

Online Tools

i have tried converting through online but it will lag too many hours to do, so finding some good idea / suggestion which can be done with script.

Thanks !!

Upvotes: 2

Views: 1230

Answers (2)

Eric Duminil
Eric Duminil

Reputation: 54303

You could use sass-convert from the sass gem :

sass-convert -R my_css_dir --from css --to scss

To convert every .css file inside my_css_dir

Note: It seems that you need sass 3.4.22. See here and there.

Upvotes: 2

Farkhat Mikhalko
Farkhat Mikhalko

Reputation: 3665

Ruby gem sass contains sass-converter utility, so you can use them.

Docs:

The sass-convert executable converts between CSS, Sass, and SCSS. When converting from CSS to Sass or SCSS, nesting is applied where appropriate. See sass-convert --help for further information and options.

bundle exec sass-convert ...

See sass-convert --help for further information and options.

Source file from github. Readme.

Gem repository.

Upvotes: 1

Related Questions