CSS Master

(Primo) #1
lessc /path/to/lessstylesheet.less

You’llneedtorunlessceverytimeyouwishtocompileyourLessfilestoCSS.
OnewayaroundthislimitationistouseanapplicationsuchasKoala,Harp,or
CodeKit,insteadoftheNode.jsversion.Theseapplicationswill“watch”yourLess
filesordirectoriesforchanges,rewritingCSSfileswitheverysave.Ifyou’rebuilding
aGruntorGulpworkflow,youcanalsousethegrunt-lessorgulp-lessplugins
torunthelessccommandwheneveryousaveafile.


RunninglesscwillprintCSStotheterminalwindowbydefault;however,youcan
redirectthatoutputtoafile:


lessc /path/to/lessstylesheet.less > /path/to/output.css

IfyouwishtominifyyourCSSoutput,usethe-xflag:


lessc -x /path/to/lessstylesheet.less > /path/to/output.css

Whenusingthecommandlinetool,Lessfilesdon’trequirea.lessextension.You
coulduse.cssor.lcssinstead;however,third-partyapplicationsandclient-sideLess
requireit.Forthebroadestcompatibility,use.less.


Installing Sass


SasswasoriginallywrittenasaRubygem.Inrecentyears,though,it’sbeenported
toaC/C++libraryknownasLibSass.Asaresult,Sasstoolsarealsoavailablefor
Python,Node.js,andotherplatforms.


Ifthecommandlinemakesyouskittish,thereareseveralopen-sourceandpaid
applicationsthatincludeSasssupport.TheseincludetheaforementionedKoala,
Harp,andCodeKit.AnotheroptionisScout.^8


We’llfocusontheRuby-basedversionofSassinthischapter,asit’sthedefinitive
implementationofSass.You’llneedtoinstallRubyifyou’reyettodoso;however,
settingupaserverorknowinganythingaboutprogrammingwithRubyisnotre-
quiredinorderuseSass.ToinstallSass,usethefollowingcommand:


(^8) http://mhs.github.io/scout-app/
Preprocessors 331

Free download pdf