gem install sassOSXandLinuxusersmayneedtousesudo.Using Sass from the Command Line
AswithLess,youcanuseSassfromthecommandlinetocompileyourfilestoCSS.
Sassfilesshouldbesavedwithan.scssextension:sass sassfile.scss output.cssSass Syntaxes
Sasshastwosyntaxes:originalSasssyntaxandSCSS(orSassyCSS).Original
Sasssyntaxusesindentationratherthancurlybracestodelineaterulesets.SCSS
ismorelikeasupersetofplainCSS,andusescurlybraces.We’llbefocusingon
SCSS.FilesthatemployoriginalSasssyntaxshouldusea.sassextension.Sassalsosupportsbasicminification.Justadd--style=compressedtoyoursass
command:sass sassfile.scss output.css --style=compressedWiththe--watchflag,SasscanalsoupdateCSSoutputaftereverysavedchange:sass --watch sassfile.scss:output.cssAdditionally,Sasscanwatchandoutputentiredirectoriesoffiles:sass --watch /path/to/scss/:/path/to/css/EachSassfileinawatcheddirectorywillbecompiledtoacorrespondingCSSone.Nowthatwe’velookedathowtoinstallanduseLessandSass,let’sdigintothe
commonfeaturesofboth.332 CSS Master