Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to validate scss

I have a scss file, and I compile it into a css file using scss. The scss to css compiler detects the errors in the scss file, but it seems too tolerant. That is, even when I mistype the name of the style attributes, it compiles without an error. Is there a way to make it return an error when there is a style attribute in the scss file that does not exist in css3 or in the imported features? There is also a possibility of writing an invalid value for the styles, but I know that is more complicated, and I am not asking for that.

like image 627
sawa Avatar asked Jan 02 '13 18:01

sawa


People also ask

Can CSS style sheets be validated?

A CSS validator checks your Cascading Style Sheets to make sure that they comply with the CSS standards set by the W3 Consortium. There are a few validators which will also tell you which CSS features are supported by which browsers (since not all browsers are equal in their CSS implementation).

What is SCSS compiler?

SCSS is a CSS preprocessor language that adds many features like variables, mixins, imports, nesting, color manipulation, functions, and control directives. scssphp is ready for inclusion in any project. It includes a command line tool for running the compiler from a terminal/shell or script.


1 Answers

There is a Ruby wrapper around the W3C CSS Validator so you can write a simple script to check the output css from scss.

I also found this integration with Compass so if you use Compass to compile your scss, it might be helpful. I haven't used this so I'm not sure how it works but I've had a good experience with the W3C CSS Validator.

like image 156
sunnyrjuneja Avatar answered Oct 14 '22 23:10

sunnyrjuneja