Differences Between Sass and LESS Preprocessors - The ...

文章推薦指數: 80 %
投票人數:10人

Syntactically Awesome Stylesheets (Sass) and Leaner CSS (LESS) are both CSS preprocessors. They are special stylesheet extensions that make ... TechnologyCareers Skills SassandLESSPreprocessors Webdevelopersshouldbefamiliarwithoneorbothpreprocessors By LaurenceBradford FullBio LinkedIn Twitter LaurenceBradfordwroteaboutcomputerprogrammingforTheBalanceCareers.Sheisaformercopywriterturnedfront-enddeveloper. Learnaboutour editorialpolicies UpdatedonNovember20,2019 CokeorPepsi,MacorPC,MarvelorDC? Ineverycommunity,there’sadebateoverwhichisbetter. Forwebdesignersordevelopers,thatdebateisSassorLESS. SyntacticallyAwesomeStylesheets(Sass)andLeanerCSS(LESS)arebothCSSpreprocessors.Theyarespecialstylesheetextensionsthatmake designingeasierandmoreefficient.BothSassandLESScompileintoCSSstylesheetssothatbrowserscanreadthem.Thisisanecessarystepbecausemodernbrowserscannotread.sassor.lessfiletypes. Ifyouplanonbeingintheworldofwebdevelopment,it’sagoodideatobewell-versedinoneofthetwopreprocessors—ifnotbothofthem. Whenitcomesdowntoit,theyhavealotofsimilarities.TheymakewritingCSSsimpler,moreobject-oriented,andmoreenjoyable.Nevertheless,thereareafewkeydifferences.  SassIsinRubyWhileLESSIsinJavascript ShannonFagan/GettyImages SassisbasedinRubyandrequiresaRubyinstall.ThisisnobigdealifyouhaveaMac.However,itisalongerinstallationifyouhaveaWindowsmachine. LESSwasconstructedinRuby,likeSass,butithasbeenportedtoJavaScript.TouseLESS,youmustuploadtheapplicableJavaScriptfilestoyourserverorcompiletheCSSsheetsthroughanofflinecompiler. ToAssignVariables,SassUses'$'WhileLESSUses'@'  LuisAlvarez/GettyImages BothSassandLESSusespecializedcharacterstoassignvariables.Thisispartofthebenefitofusingthesepreprocessors.Youdon’thavetokeepenteringspecificationseverytimeyouwanttoassignvariables.Instead,youcanjustenterthecharacter. InSass,it’sthedollarsign($).InLESS,it’sthe"at" symbol(@).TheonlydownsideforLESSisthatthereareafewexistingCSSselectorsthatalreadyuse@.Thatcomplication couldstiffenthelearningcurveabit. SassHasCompassWhileLESSHasPreboot  Caiaimage/GerttyImages SassandLESShaveextensionsavailabletointegratemixins(theabilitytostoreandshareCSSdeclarationsthroughoutasite). Sassuses Compassformixins,whichincludeseveryoptionavailablewithupdatesforfuturesupport. LESShasPreboot.less,LESSMixins,LESSElements,gs,andFrameless.LESS’ssoftwaresupportismorefragmentedthanSass,resultinginalotofdifferentoptionsforextensionsthatmaynotallfunctionthesameway.Foryourproject,youmayneedtousemultiple(orall)ofthelistedextensionstoreplicatetheperformanceofCompass. LESSHasBetterErrorMessagesThanSass  RazvanChisu/GettyImages BothSassandLESShavebeentestedfortheirabilitytoreporterrorsinsyntax.LESShasmoreaccurateerrormessagesinthe tests—itreportedthecorrectlocationoftheerror.Thiscancomeinhandywhenatypoisderailingthecode.LESSerrormessagescanhelpyouquicklyidentifytheproblem. LESSHasMoreUser-FriendlyDocumentationThanSass  HeroImages/GettyImages  TheLESSdocumentationisvisuallyappealingandeasiertofollowforfirst-timeusers.TheSassdocumentationrequireseithermuchmoreofbaseknowledge,orfrequentcross-referenceswithawikiduringsetup.​​ ThisfactinandofitselfcouldweighheavilyontheadoptionratesofeitherSassorLESS. Share Tweet Share Email BestBookWritingSoftwareof2022 TheBestOnlineCodingClassesin2022 DiscovertheCoreSkillsYouNeedtoMasterasaFront-EndDeveloper Example:WebDeveloperResumeWithSummaryStatementExample Front-EndWebDeveloperCoverLetterandResumeExamples PlacestoLearnJavaScriptOnline 18ProgrammersYouShouldFollowonTwitter TheBestJobOptionsforTradeSchoolGraduates What'stheDifferenceBetweenaResumeandaCurriculumVitae? WebDeveloperJobDescription:Salary,Skills,&More TheSkillsYouNeedtoBeaBack-EndDeveloper 19TechTermsYouShouldKnow 10RewardingJobsYouCanGetWithoutaFour-YearDegree BestPlacestoLearntoCodeforFree 100+FreeProfessionalResumeExamples HateWorkinginanOffice?TheseArethePerfectJobsforYou



請為這篇文章評分?