sawa
sawa

Reputation: 168101

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.

Upvotes: 9

Views: 27270

Answers (3)

rawr51919
rawr51919

Reputation: 19

I would suggest, if you want a validator that's built into your NodeJS development (there may be others for different languages too, but this is what I found), scss-validator: https://www.npmjs.com/package/scss-validator

Upvotes: 0

stevec
stevec

Reputation: 52308

I'd really like the same thing built into rails or my development environment somehow.

I found this online tool to be incredibly helpful (it finds errors, but also hints at things I was doing that could cause unintended results)

http://beautifytools.com/scss-compiler.php

Copy paste .scss file into the left hand side and click 'Compile SCSS'

Upvotes: 0

sunnyrjuneja
sunnyrjuneja

Reputation: 6123

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.

Upvotes: 1

Related Questions