Can I Convert Css To Scss And Scss To Css Parallelly?


Answer :

It is possible, but not ideal. Your best bet is to crack open your terminal and run

sass-convert --from css --to scss 

in the directory where your styles are located and then refactor from there. It's a pain, and not a true "conversion". It tries to nest properly, and usually gets it right, but if you're not refactoring the code and using things like mix-ins, extends, and variables, it kind of defeats the purpose of using SASS to begin with.

To automate this, you may want to use something like Guard to watch the css files for changes. You'll want to make sure you're not also watching your main style (the one that sass is compiling to), as this will put you in a never-ending loop of conversion!


Use a command for installing compass

gem install compass 

Run this command. This will scan defined directory for css files and convert them to scss files.

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

Then execute this command

compass watch 

This will watch scss files for changes and convert them to css files automatically.


I'd say no — or at least, not easily. SCSS is fully compatible with regular CSS, and it does compile to CSS, but not the other way around, so the source file should be either CSS or SCSS.

Still, it depends on your project. Say two members are working on two completely separate parts of the projects. They can use separate files, and choose to work in either SCSS or CSS. Their files may then be included in a main SCSS file or otherwise be merged together with a build script — or be kept separate in production, even. That wouldn't be any problem.

Still, I'd always prefer all the team members to work in a similar way, so that they can easilly cover each other when there's a problem.


Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?