Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 445KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <title>postcss 7.0.18 | Documentation</title>
  6. <meta name='description' content='Tool for transforming styles with JS plugins'>
  7. <meta name='viewport' content='width=device-width,initial-scale=1'>
  8. <link href='assets/styles.min.css' rel='stylesheet' />
  9. </head>
  10. <body class='documentation'>
  11. <div class='px2'>
  12. <div class='clearfix md-flex lg-flex flex-stretch mxn2'>
  13. <div class='documentation-sidebar relative top-0 bottom-0 right-0 px2 py2 col-3 md-show'>
  14. <div class='font-smaller fixed col-3 top-0 bottom-0 left-0 overflow-auto fill-light dark-link'>
  15. <div class='px2'>
  16. <h3 class='mb0 no-anchor'><code>postcss</code></h3>
  17. <div class='mb1'><code>7.0.18</code></div>
  18. <input placeholder='Filter' id='filter-input' class='col12 block input' type='text' />
  19. <div id="toc">
  20. <a
  21. href='#classes'
  22. class="blockmt1 quiet rounded bold block h4 mt2 ">
  23. <code>CLASSES</code>
  24. </a>
  25. <a
  26. href='#atrule'
  27. class="regular block toggle-sibling">
  28. <code>AtRule</code>
  29. <span class='icon'>▾</span>
  30. </a>
  31. <div class='toggle-target'>
  32. <a
  33. href='#atruleappend'
  34. class='button-indent regular block'>
  35. <code>#append</code>
  36. </a>
  37. <a
  38. href='#atruleeach'
  39. class='button-indent regular block'>
  40. <code>#each</code>
  41. </a>
  42. <a
  43. href='#atruleevery'
  44. class='button-indent regular block'>
  45. <code>#every</code>
  46. </a>
  47. <a
  48. href='#atrulefirst'
  49. class='button-indent regular block'>
  50. <code>#first</code>
  51. </a>
  52. <a
  53. href='#atruleindex'
  54. class='button-indent regular block'>
  55. <code>#index</code>
  56. </a>
  57. <a
  58. href='#atruleinsertafter'
  59. class='button-indent regular block'>
  60. <code>#insertAfter</code>
  61. </a>
  62. <a
  63. href='#atruleinsertbefore'
  64. class='button-indent regular block'>
  65. <code>#insertBefore</code>
  66. </a>
  67. <a
  68. href='#atrulelast'
  69. class='button-indent regular block'>
  70. <code>#last</code>
  71. </a>
  72. <a
  73. href='#atruleprepend'
  74. class='button-indent regular block'>
  75. <code>#prepend</code>
  76. </a>
  77. <a
  78. href='#atruleremoveall'
  79. class='button-indent regular block'>
  80. <code>#removeAll</code>
  81. </a>
  82. <a
  83. href='#atruleremovechild'
  84. class='button-indent regular block'>
  85. <code>#removeChild</code>
  86. </a>
  87. <a
  88. href='#atrulereplacevalues'
  89. class='button-indent regular block'>
  90. <code>#replaceValues</code>
  91. </a>
  92. <a
  93. href='#atrulesome'
  94. class='button-indent regular block'>
  95. <code>#some</code>
  96. </a>
  97. <a
  98. href='#atrulewalk'
  99. class='button-indent regular block'>
  100. <code>#walk</code>
  101. </a>
  102. <a
  103. href='#atrulewalkatrules'
  104. class='button-indent regular block'>
  105. <code>#walkAtRules</code>
  106. </a>
  107. <a
  108. href='#atrulewalkcomments'
  109. class='button-indent regular block'>
  110. <code>#walkComments</code>
  111. </a>
  112. <a
  113. href='#atrulewalkdecls'
  114. class='button-indent regular block'>
  115. <code>#walkDecls</code>
  116. </a>
  117. <a
  118. href='#atrulewalkrules'
  119. class='button-indent regular block'>
  120. <code>#walkRules</code>
  121. </a>
  122. </div>
  123. <a
  124. href='#comment'
  125. class="regular block toggle-sibling">
  126. <code>Comment</code>
  127. <span class='icon'>▾</span>
  128. </a>
  129. <div class='toggle-target'>
  130. <a
  131. href='#commentafter'
  132. class='button-indent regular block'>
  133. <code>#after</code>
  134. </a>
  135. <a
  136. href='#commentbefore'
  137. class='button-indent regular block'>
  138. <code>#before</code>
  139. </a>
  140. <a
  141. href='#commentcleanraws'
  142. class='button-indent regular block'>
  143. <code>#cleanRaws</code>
  144. </a>
  145. <a
  146. href='#commentclone'
  147. class='button-indent regular block'>
  148. <code>#clone</code>
  149. </a>
  150. <a
  151. href='#commentcloneafter'
  152. class='button-indent regular block'>
  153. <code>#cloneAfter</code>
  154. </a>
  155. <a
  156. href='#commentclonebefore'
  157. class='button-indent regular block'>
  158. <code>#cloneBefore</code>
  159. </a>
  160. <a
  161. href='#commenterror'
  162. class='button-indent regular block'>
  163. <code>#error</code>
  164. </a>
  165. <a
  166. href='#commentnext'
  167. class='button-indent regular block'>
  168. <code>#next</code>
  169. </a>
  170. <a
  171. href='#commentprev'
  172. class='button-indent regular block'>
  173. <code>#prev</code>
  174. </a>
  175. <a
  176. href='#commentraw'
  177. class='button-indent regular block'>
  178. <code>#raw</code>
  179. </a>
  180. <a
  181. href='#commentremove'
  182. class='button-indent regular block'>
  183. <code>#remove</code>
  184. </a>
  185. <a
  186. href='#commentreplacewith'
  187. class='button-indent regular block'>
  188. <code>#replaceWith</code>
  189. </a>
  190. <a
  191. href='#commentroot'
  192. class='button-indent regular block'>
  193. <code>#root</code>
  194. </a>
  195. <a
  196. href='#commenttostring'
  197. class='button-indent regular block'>
  198. <code>#toString</code>
  199. </a>
  200. <a
  201. href='#commentwarn'
  202. class='button-indent regular block'>
  203. <code>#warn</code>
  204. </a>
  205. </div>
  206. <a
  207. href='#container'
  208. class="regular block toggle-sibling">
  209. <code>Container</code>
  210. <span class='icon'>▾</span>
  211. </a>
  212. <div class='toggle-target'>
  213. <a
  214. href='#containerafter'
  215. class='button-indent regular block'>
  216. <code>#after</code>
  217. </a>
  218. <a
  219. href='#containerappend'
  220. class='button-indent regular block'>
  221. <code>#append</code>
  222. </a>
  223. <a
  224. href='#containerbefore'
  225. class='button-indent regular block'>
  226. <code>#before</code>
  227. </a>
  228. <a
  229. href='#containercleanraws'
  230. class='button-indent regular block'>
  231. <code>#cleanRaws</code>
  232. </a>
  233. <a
  234. href='#containerclone'
  235. class='button-indent regular block'>
  236. <code>#clone</code>
  237. </a>
  238. <a
  239. href='#containercloneafter'
  240. class='button-indent regular block'>
  241. <code>#cloneAfter</code>
  242. </a>
  243. <a
  244. href='#containerclonebefore'
  245. class='button-indent regular block'>
  246. <code>#cloneBefore</code>
  247. </a>
  248. <a
  249. href='#containereach'
  250. class='button-indent regular block'>
  251. <code>#each</code>
  252. </a>
  253. <a
  254. href='#containererror'
  255. class='button-indent regular block'>
  256. <code>#error</code>
  257. </a>
  258. <a
  259. href='#containerevery'
  260. class='button-indent regular block'>
  261. <code>#every</code>
  262. </a>
  263. <a
  264. href='#containerfirst'
  265. class='button-indent regular block'>
  266. <code>#first</code>
  267. </a>
  268. <a
  269. href='#containerindex'
  270. class='button-indent regular block'>
  271. <code>#index</code>
  272. </a>
  273. <a
  274. href='#containerinsertafter'
  275. class='button-indent regular block'>
  276. <code>#insertAfter</code>
  277. </a>
  278. <a
  279. href='#containerinsertbefore'
  280. class='button-indent regular block'>
  281. <code>#insertBefore</code>
  282. </a>
  283. <a
  284. href='#containerlast'
  285. class='button-indent regular block'>
  286. <code>#last</code>
  287. </a>
  288. <a
  289. href='#containernext'
  290. class='button-indent regular block'>
  291. <code>#next</code>
  292. </a>
  293. <a
  294. href='#containerprepend'
  295. class='button-indent regular block'>
  296. <code>#prepend</code>
  297. </a>
  298. <a
  299. href='#containerprev'
  300. class='button-indent regular block'>
  301. <code>#prev</code>
  302. </a>
  303. <a
  304. href='#containerraw'
  305. class='button-indent regular block'>
  306. <code>#raw</code>
  307. </a>
  308. <a
  309. href='#containerremove'
  310. class='button-indent regular block'>
  311. <code>#remove</code>
  312. </a>
  313. <a
  314. href='#containerremoveall'
  315. class='button-indent regular block'>
  316. <code>#removeAll</code>
  317. </a>
  318. <a
  319. href='#containerremovechild'
  320. class='button-indent regular block'>
  321. <code>#removeChild</code>
  322. </a>
  323. <a
  324. href='#containerreplacevalues'
  325. class='button-indent regular block'>
  326. <code>#replaceValues</code>
  327. </a>
  328. <a
  329. href='#containerreplacewith'
  330. class='button-indent regular block'>
  331. <code>#replaceWith</code>
  332. </a>
  333. <a
  334. href='#containerroot'
  335. class='button-indent regular block'>
  336. <code>#root</code>
  337. </a>
  338. <a
  339. href='#containersome'
  340. class='button-indent regular block'>
  341. <code>#some</code>
  342. </a>
  343. <a
  344. href='#containertostring'
  345. class='button-indent regular block'>
  346. <code>#toString</code>
  347. </a>
  348. <a
  349. href='#containerwalk'
  350. class='button-indent regular block'>
  351. <code>#walk</code>
  352. </a>
  353. <a
  354. href='#containerwalkatrules'
  355. class='button-indent regular block'>
  356. <code>#walkAtRules</code>
  357. </a>
  358. <a
  359. href='#containerwalkcomments'
  360. class='button-indent regular block'>
  361. <code>#walkComments</code>
  362. </a>
  363. <a
  364. href='#containerwalkdecls'
  365. class='button-indent regular block'>
  366. <code>#walkDecls</code>
  367. </a>
  368. <a
  369. href='#containerwalkrules'
  370. class='button-indent regular block'>
  371. <code>#walkRules</code>
  372. </a>
  373. <a
  374. href='#containerwarn'
  375. class='button-indent regular block'>
  376. <code>#warn</code>
  377. </a>
  378. </div>
  379. <a
  380. href='#csssyntaxerror'
  381. class="regular block toggle-sibling">
  382. <code>CssSyntaxError</code>
  383. <span class='icon'>▾</span>
  384. </a>
  385. <div class='toggle-target'>
  386. <a
  387. href='#csssyntaxerrorname'
  388. class='button-indent regular block'>
  389. <code>#name</code>
  390. </a>
  391. <a
  392. href='#csssyntaxerrorreason'
  393. class='button-indent regular block'>
  394. <code>#reason</code>
  395. </a>
  396. <a
  397. href='#csssyntaxerrorfile'
  398. class='button-indent regular block'>
  399. <code>#file</code>
  400. </a>
  401. <a
  402. href='#csssyntaxerrorsource'
  403. class='button-indent regular block'>
  404. <code>#source</code>
  405. </a>
  406. <a
  407. href='#csssyntaxerrorplugin'
  408. class='button-indent regular block'>
  409. <code>#plugin</code>
  410. </a>
  411. <a
  412. href='#csssyntaxerrorline'
  413. class='button-indent regular block'>
  414. <code>#line</code>
  415. </a>
  416. <a
  417. href='#csssyntaxerrorcolumn'
  418. class='button-indent regular block'>
  419. <code>#column</code>
  420. </a>
  421. <a
  422. href='#csssyntaxerrormessage'
  423. class='button-indent regular block'>
  424. <code>#message</code>
  425. </a>
  426. <a
  427. href='#csssyntaxerrorshowsourcecode'
  428. class='button-indent regular block'>
  429. <code>#showSourceCode</code>
  430. </a>
  431. <a
  432. href='#csssyntaxerrortostring'
  433. class='button-indent regular block'>
  434. <code>#toString</code>
  435. </a>
  436. </div>
  437. <a
  438. href='#declaration'
  439. class="regular block toggle-sibling">
  440. <code>Declaration</code>
  441. <span class='icon'>▾</span>
  442. </a>
  443. <div class='toggle-target'>
  444. <a
  445. href='#declarationafter'
  446. class='button-indent regular block'>
  447. <code>#after</code>
  448. </a>
  449. <a
  450. href='#declarationbefore'
  451. class='button-indent regular block'>
  452. <code>#before</code>
  453. </a>
  454. <a
  455. href='#declarationcleanraws'
  456. class='button-indent regular block'>
  457. <code>#cleanRaws</code>
  458. </a>
  459. <a
  460. href='#declarationclone'
  461. class='button-indent regular block'>
  462. <code>#clone</code>
  463. </a>
  464. <a
  465. href='#declarationcloneafter'
  466. class='button-indent regular block'>
  467. <code>#cloneAfter</code>
  468. </a>
  469. <a
  470. href='#declarationclonebefore'
  471. class='button-indent regular block'>
  472. <code>#cloneBefore</code>
  473. </a>
  474. <a
  475. href='#declarationerror'
  476. class='button-indent regular block'>
  477. <code>#error</code>
  478. </a>
  479. <a
  480. href='#declarationnext'
  481. class='button-indent regular block'>
  482. <code>#next</code>
  483. </a>
  484. <a
  485. href='#declarationprev'
  486. class='button-indent regular block'>
  487. <code>#prev</code>
  488. </a>
  489. <a
  490. href='#declarationraw'
  491. class='button-indent regular block'>
  492. <code>#raw</code>
  493. </a>
  494. <a
  495. href='#declarationremove'
  496. class='button-indent regular block'>
  497. <code>#remove</code>
  498. </a>
  499. <a
  500. href='#declarationreplacewith'
  501. class='button-indent regular block'>
  502. <code>#replaceWith</code>
  503. </a>
  504. <a
  505. href='#declarationroot'
  506. class='button-indent regular block'>
  507. <code>#root</code>
  508. </a>
  509. <a
  510. href='#declarationtostring'
  511. class='button-indent regular block'>
  512. <code>#toString</code>
  513. </a>
  514. <a
  515. href='#declarationwarn'
  516. class='button-indent regular block'>
  517. <code>#warn</code>
  518. </a>
  519. </div>
  520. <a
  521. href='#input'
  522. class="regular block toggle-sibling">
  523. <code>Input</code>
  524. <span class='icon'>▾</span>
  525. </a>
  526. <div class='toggle-target'>
  527. <a
  528. href='#inputcss'
  529. class='button-indent regular block'>
  530. <code>#css</code>
  531. </a>
  532. <a
  533. href='#inputfile'
  534. class='button-indent regular block'>
  535. <code>#file</code>
  536. </a>
  537. <a
  538. href='#inputmap'
  539. class='button-indent regular block'>
  540. <code>#map</code>
  541. </a>
  542. <a
  543. href='#inputid'
  544. class='button-indent regular block'>
  545. <code>#id</code>
  546. </a>
  547. <a
  548. href='#inputorigin'
  549. class='button-indent regular block'>
  550. <code>#origin</code>
  551. </a>
  552. <a
  553. href='#inputfrom'
  554. class='button-indent regular block'>
  555. <code>#from</code>
  556. </a>
  557. </div>
  558. <a
  559. href='#lazyresult'
  560. class="regular block toggle-sibling">
  561. <code>LazyResult</code>
  562. <span class='icon'>▾</span>
  563. </a>
  564. <div class='toggle-target'>
  565. <a
  566. href='#lazyresultprocessor'
  567. class='button-indent regular block'>
  568. <code>#processor</code>
  569. </a>
  570. <a
  571. href='#lazyresultopts'
  572. class='button-indent regular block'>
  573. <code>#opts</code>
  574. </a>
  575. <a
  576. href='#lazyresultcss'
  577. class='button-indent regular block'>
  578. <code>#css</code>
  579. </a>
  580. <a
  581. href='#lazyresultcontent'
  582. class='button-indent regular block'>
  583. <code>#content</code>
  584. </a>
  585. <a
  586. href='#lazyresultmap'
  587. class='button-indent regular block'>
  588. <code>#map</code>
  589. </a>
  590. <a
  591. href='#lazyresultroot'
  592. class='button-indent regular block'>
  593. <code>#root</code>
  594. </a>
  595. <a
  596. href='#lazyresultmessages'
  597. class='button-indent regular block'>
  598. <code>#messages</code>
  599. </a>
  600. <a
  601. href='#lazyresultwarnings'
  602. class='button-indent regular block'>
  603. <code>#warnings</code>
  604. </a>
  605. <a
  606. href='#lazyresulttostring'
  607. class='button-indent regular block'>
  608. <code>#toString</code>
  609. </a>
  610. <a
  611. href='#lazyresultthen'
  612. class='button-indent regular block'>
  613. <code>#then</code>
  614. </a>
  615. <a
  616. href='#lazyresultcatch'
  617. class='button-indent regular block'>
  618. <code>#catch</code>
  619. </a>
  620. <a
  621. href='#lazyresultfinally'
  622. class='button-indent regular block'>
  623. <code>#finally</code>
  624. </a>
  625. </div>
  626. <a
  627. href='#node'
  628. class="regular block toggle-sibling">
  629. <code>Node</code>
  630. <span class='icon'>▾</span>
  631. </a>
  632. <div class='toggle-target'>
  633. <a
  634. href='#nodeerror'
  635. class='button-indent regular block'>
  636. <code>#error</code>
  637. </a>
  638. <a
  639. href='#nodewarn'
  640. class='button-indent regular block'>
  641. <code>#warn</code>
  642. </a>
  643. <a
  644. href='#noderemove'
  645. class='button-indent regular block'>
  646. <code>#remove</code>
  647. </a>
  648. <a
  649. href='#nodetostring'
  650. class='button-indent regular block'>
  651. <code>#toString</code>
  652. </a>
  653. <a
  654. href='#nodeclone'
  655. class='button-indent regular block'>
  656. <code>#clone</code>
  657. </a>
  658. <a
  659. href='#nodeclonebefore'
  660. class='button-indent regular block'>
  661. <code>#cloneBefore</code>
  662. </a>
  663. <a
  664. href='#nodecloneafter'
  665. class='button-indent regular block'>
  666. <code>#cloneAfter</code>
  667. </a>
  668. <a
  669. href='#nodereplacewith'
  670. class='button-indent regular block'>
  671. <code>#replaceWith</code>
  672. </a>
  673. <a
  674. href='#nodenext'
  675. class='button-indent regular block'>
  676. <code>#next</code>
  677. </a>
  678. <a
  679. href='#nodeprev'
  680. class='button-indent regular block'>
  681. <code>#prev</code>
  682. </a>
  683. <a
  684. href='#nodebefore'
  685. class='button-indent regular block'>
  686. <code>#before</code>
  687. </a>
  688. <a
  689. href='#nodeafter'
  690. class='button-indent regular block'>
  691. <code>#after</code>
  692. </a>
  693. <a
  694. href='#noderaw'
  695. class='button-indent regular block'>
  696. <code>#raw</code>
  697. </a>
  698. <a
  699. href='#noderoot'
  700. class='button-indent regular block'>
  701. <code>#root</code>
  702. </a>
  703. <a
  704. href='#nodecleanraws'
  705. class='button-indent regular block'>
  706. <code>#cleanRaws</code>
  707. </a>
  708. </div>
  709. <a
  710. href='#previousmap'
  711. class="regular block toggle-sibling">
  712. <code>PreviousMap</code>
  713. <span class='icon'>▾</span>
  714. </a>
  715. <div class='toggle-target'>
  716. <a
  717. href='#previousmapinline'
  718. class='button-indent regular block'>
  719. <code>#inline</code>
  720. </a>
  721. <a
  722. href='#previousmapconsumer'
  723. class='button-indent regular block'>
  724. <code>#consumer</code>
  725. </a>
  726. <a
  727. href='#previousmapwithcontent'
  728. class='button-indent regular block'>
  729. <code>#withContent</code>
  730. </a>
  731. </div>
  732. <a
  733. href='#processor'
  734. class="regular block toggle-sibling">
  735. <code>Processor</code>
  736. <span class='icon'>▾</span>
  737. </a>
  738. <div class='toggle-target'>
  739. <a
  740. href='#processorversion'
  741. class='button-indent regular block'>
  742. <code>#version</code>
  743. </a>
  744. <a
  745. href='#processorplugins'
  746. class='button-indent regular block'>
  747. <code>#plugins</code>
  748. </a>
  749. <a
  750. href='#processoruse'
  751. class='button-indent regular block'>
  752. <code>#use</code>
  753. </a>
  754. <a
  755. href='#processorprocess'
  756. class='button-indent regular block'>
  757. <code>#process</code>
  758. </a>
  759. </div>
  760. <a
  761. href='#result'
  762. class="regular block toggle-sibling">
  763. <code>Result</code>
  764. <span class='icon'>▾</span>
  765. </a>
  766. <div class='toggle-target'>
  767. <a
  768. href='#resultprocessor'
  769. class='button-indent regular block'>
  770. <code>#processor</code>
  771. </a>
  772. <a
  773. href='#resultmessages'
  774. class='button-indent regular block'>
  775. <code>#messages</code>
  776. </a>
  777. <a
  778. href='#resultroot'
  779. class='button-indent regular block'>
  780. <code>#root</code>
  781. </a>
  782. <a
  783. href='#resultopts'
  784. class='button-indent regular block'>
  785. <code>#opts</code>
  786. </a>
  787. <a
  788. href='#resultcss'
  789. class='button-indent regular block'>
  790. <code>#css</code>
  791. </a>
  792. <a
  793. href='#resultmap'
  794. class='button-indent regular block'>
  795. <code>#map</code>
  796. </a>
  797. <a
  798. href='#resulttostring'
  799. class='button-indent regular block'>
  800. <code>#toString</code>
  801. </a>
  802. <a
  803. href='#resultwarn'
  804. class='button-indent regular block'>
  805. <code>#warn</code>
  806. </a>
  807. <a
  808. href='#resultwarnings'
  809. class='button-indent regular block'>
  810. <code>#warnings</code>
  811. </a>
  812. <a
  813. href='#resultcontent'
  814. class='button-indent regular block'>
  815. <code>#content</code>
  816. </a>
  817. </div>
  818. <a
  819. href='#root'
  820. class="regular block toggle-sibling">
  821. <code>Root</code>
  822. <span class='icon'>▾</span>
  823. </a>
  824. <div class='toggle-target'>
  825. <a
  826. href='#rootappend'
  827. class='button-indent regular block'>
  828. <code>#append</code>
  829. </a>
  830. <a
  831. href='#rooteach'
  832. class='button-indent regular block'>
  833. <code>#each</code>
  834. </a>
  835. <a
  836. href='#rootevery'
  837. class='button-indent regular block'>
  838. <code>#every</code>
  839. </a>
  840. <a
  841. href='#rootfirst'
  842. class='button-indent regular block'>
  843. <code>#first</code>
  844. </a>
  845. <a
  846. href='#rootindex'
  847. class='button-indent regular block'>
  848. <code>#index</code>
  849. </a>
  850. <a
  851. href='#rootinsertafter'
  852. class='button-indent regular block'>
  853. <code>#insertAfter</code>
  854. </a>
  855. <a
  856. href='#rootinsertbefore'
  857. class='button-indent regular block'>
  858. <code>#insertBefore</code>
  859. </a>
  860. <a
  861. href='#rootlast'
  862. class='button-indent regular block'>
  863. <code>#last</code>
  864. </a>
  865. <a
  866. href='#rooton'
  867. class='button-indent regular block'>
  868. <code>#on</code>
  869. </a>
  870. <a
  871. href='#rootprepend'
  872. class='button-indent regular block'>
  873. <code>#prepend</code>
  874. </a>
  875. <a
  876. href='#rootremoveall'
  877. class='button-indent regular block'>
  878. <code>#removeAll</code>
  879. </a>
  880. <a
  881. href='#rootremovechild'
  882. class='button-indent regular block'>
  883. <code>#removeChild</code>
  884. </a>
  885. <a
  886. href='#rootreplacevalues'
  887. class='button-indent regular block'>
  888. <code>#replaceValues</code>
  889. </a>
  890. <a
  891. href='#rootsome'
  892. class='button-indent regular block'>
  893. <code>#some</code>
  894. </a>
  895. <a
  896. href='#roottoresult'
  897. class='button-indent regular block'>
  898. <code>#toResult</code>
  899. </a>
  900. <a
  901. href='#rootwalk'
  902. class='button-indent regular block'>
  903. <code>#walk</code>
  904. </a>
  905. <a
  906. href='#rootwalkatrules'
  907. class='button-indent regular block'>
  908. <code>#walkAtRules</code>
  909. </a>
  910. <a
  911. href='#rootwalkcomments'
  912. class='button-indent regular block'>
  913. <code>#walkComments</code>
  914. </a>
  915. <a
  916. href='#rootwalkdecls'
  917. class='button-indent regular block'>
  918. <code>#walkDecls</code>
  919. </a>
  920. <a
  921. href='#rootwalkrules'
  922. class='button-indent regular block'>
  923. <code>#walkRules</code>
  924. </a>
  925. </div>
  926. <a
  927. href='#rule'
  928. class="regular block toggle-sibling">
  929. <code>Rule</code>
  930. <span class='icon'>▾</span>
  931. </a>
  932. <div class='toggle-target'>
  933. <a
  934. href='#ruleappend'
  935. class='button-indent regular block'>
  936. <code>#append</code>
  937. </a>
  938. <a
  939. href='#ruleeach'
  940. class='button-indent regular block'>
  941. <code>#each</code>
  942. </a>
  943. <a
  944. href='#ruleevery'
  945. class='button-indent regular block'>
  946. <code>#every</code>
  947. </a>
  948. <a
  949. href='#rulefirst'
  950. class='button-indent regular block'>
  951. <code>#first</code>
  952. </a>
  953. <a
  954. href='#ruleindex'
  955. class='button-indent regular block'>
  956. <code>#index</code>
  957. </a>
  958. <a
  959. href='#ruleinsertafter'
  960. class='button-indent regular block'>
  961. <code>#insertAfter</code>
  962. </a>
  963. <a
  964. href='#ruleinsertbefore'
  965. class='button-indent regular block'>
  966. <code>#insertBefore</code>
  967. </a>
  968. <a
  969. href='#rulelast'
  970. class='button-indent regular block'>
  971. <code>#last</code>
  972. </a>
  973. <a
  974. href='#ruleprepend'
  975. class='button-indent regular block'>
  976. <code>#prepend</code>
  977. </a>
  978. <a
  979. href='#ruleremoveall'
  980. class='button-indent regular block'>
  981. <code>#removeAll</code>
  982. </a>
  983. <a
  984. href='#ruleremovechild'
  985. class='button-indent regular block'>
  986. <code>#removeChild</code>
  987. </a>
  988. <a
  989. href='#rulereplacevalues'
  990. class='button-indent regular block'>
  991. <code>#replaceValues</code>
  992. </a>
  993. <a
  994. href='#ruleselectors'
  995. class='button-indent regular block'>
  996. <code>#selectors</code>
  997. </a>
  998. <a
  999. href='#rulesome'
  1000. class='button-indent regular block'>
  1001. <code>#some</code>
  1002. </a>
  1003. <a
  1004. href='#rulewalk'
  1005. class='button-indent regular block'>
  1006. <code>#walk</code>
  1007. </a>
  1008. <a
  1009. href='#rulewalkatrules'
  1010. class='button-indent regular block'>
  1011. <code>#walkAtRules</code>
  1012. </a>
  1013. <a
  1014. href='#rulewalkcomments'
  1015. class='button-indent regular block'>
  1016. <code>#walkComments</code>
  1017. </a>
  1018. <a
  1019. href='#rulewalkdecls'
  1020. class='button-indent regular block'>
  1021. <code>#walkDecls</code>
  1022. </a>
  1023. <a
  1024. href='#rulewalkrules'
  1025. class='button-indent regular block'>
  1026. <code>#walkRules</code>
  1027. </a>
  1028. </div>
  1029. <a
  1030. href='#warning'
  1031. class="regular block toggle-sibling">
  1032. <code>Warning</code>
  1033. <span class='icon'>▾</span>
  1034. </a>
  1035. <div class='toggle-target'>
  1036. <a
  1037. href='#warningtype'
  1038. class='button-indent regular block'>
  1039. <code>#type</code>
  1040. </a>
  1041. <a
  1042. href='#warningtext'
  1043. class='button-indent regular block'>
  1044. <code>#text</code>
  1045. </a>
  1046. <a
  1047. href='#warningline'
  1048. class='button-indent regular block'>
  1049. <code>#line</code>
  1050. </a>
  1051. <a
  1052. href='#warningcolumn'
  1053. class='button-indent regular block'>
  1054. <code>#column</code>
  1055. </a>
  1056. <a
  1057. href='#warningtostring'
  1058. class='button-indent regular block'>
  1059. <code>#toString</code>
  1060. </a>
  1061. </div>
  1062. <a
  1063. href='#namespaces'
  1064. class="blockmt1 quiet rounded bold block h4 mt2 ">
  1065. <code>NAMESPACES</code>
  1066. </a>
  1067. <a
  1068. href='#list'
  1069. class="regular block toggle-sibling">
  1070. <code>list</code>
  1071. <span class='icon'>▾</span>
  1072. </a>
  1073. <div class='toggle-target'>
  1074. <a
  1075. href='#listspace'
  1076. class='button-indent px1 quiet regular rounded block'>
  1077. <code>.space</code>
  1078. </a>
  1079. <a
  1080. href='#listcomma'
  1081. class='button-indent px1 quiet regular rounded block'>
  1082. <code>.comma</code>
  1083. </a>
  1084. </div>
  1085. <a
  1086. href='#postcss'
  1087. class="regular block toggle-sibling">
  1088. <code>postcss</code>
  1089. <span class='icon'>▾</span>
  1090. </a>
  1091. <div class='toggle-target'>
  1092. <a
  1093. href='#postcssplugin'
  1094. class='button-indent px1 quiet regular rounded block'>
  1095. <code>.plugin</code>
  1096. </a>
  1097. <a
  1098. href='#postcssstringify'
  1099. class='button-indent px1 quiet regular rounded block'>
  1100. <code>.stringify</code>
  1101. </a>
  1102. <a
  1103. href='#postcssparse'
  1104. class='button-indent px1 quiet regular rounded block'>
  1105. <code>.parse</code>
  1106. </a>
  1107. <a
  1108. href='#postcssvendor'
  1109. class='button-indent px1 quiet regular rounded block'>
  1110. <code>.vendor</code>
  1111. </a>
  1112. <a
  1113. href='#postcsslist'
  1114. class='button-indent px1 quiet regular rounded block'>
  1115. <code>.list</code>
  1116. </a>
  1117. <a
  1118. href='#postcsscomment'
  1119. class='button-indent px1 quiet regular rounded block'>
  1120. <code>.comment</code>
  1121. </a>
  1122. <a
  1123. href='#postcssatrule'
  1124. class='button-indent px1 quiet regular rounded block'>
  1125. <code>.atRule</code>
  1126. </a>
  1127. <a
  1128. href='#postcssdecl'
  1129. class='button-indent px1 quiet regular rounded block'>
  1130. <code>.decl</code>
  1131. </a>
  1132. <a
  1133. href='#postcssrule'
  1134. class='button-indent px1 quiet regular rounded block'>
  1135. <code>.rule</code>
  1136. </a>
  1137. <a
  1138. href='#postcssroot'
  1139. class='button-indent px1 quiet regular rounded block'>
  1140. <code>.root</code>
  1141. </a>
  1142. </div>
  1143. <a
  1144. href='#vendor'
  1145. class="regular block toggle-sibling">
  1146. <code>vendor</code>
  1147. <span class='icon'>▾</span>
  1148. </a>
  1149. <div class='toggle-target'>
  1150. <a
  1151. href='#vendorprefix'
  1152. class='button-indent px1 quiet regular rounded block'>
  1153. <code>.prefix</code>
  1154. </a>
  1155. <a
  1156. href='#vendorunprefixed'
  1157. class='button-indent px1 quiet regular rounded block'>
  1158. <code>.unprefixed</code>
  1159. </a>
  1160. </div>
  1161. <a
  1162. href='#global'
  1163. class="blockmt1 quiet rounded bold block h4 mt2 ">
  1164. <code>GLOBAL</code>
  1165. </a>
  1166. </div>
  1167. <div class='mt1 h6 quiet'>
  1168. <a href='https://documentation.js.org/reading-documentation.html'>Need help reading this?</a>
  1169. </div>
  1170. </div>
  1171. </div>
  1172. </div>
  1173. <div class='sm-col-12 md-col-9 lg-col-9 flex flex-column'>
  1174. <div class='flex-auto full-width'>
  1175. <div class="hide">
  1176. <section class='py2 clearfix'>
  1177. <h2 id='classes' class='mt0'>
  1178. CLASSES
  1179. </h2>
  1180. </section>
  1181. </div>
  1182. <section id='atrule'class='mt2 mb2 px3 py1 keyline-top'>
  1183. <div class='right py2'>
  1184. <span class='font-smaller'>
  1185. Extends
  1186. <a href="#container">Container</a>
  1187. </span>
  1188. <span class="px2"></span>
  1189. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/at-rule.js#L21-L90'>
  1190. <span>lib/at-rule.js</span>
  1191. </a>
  1192. </div>
  1193. <h3 class='regular'>
  1194. <a class='black' href='#atrule'>
  1195. <code>
  1196. AtRule
  1197. <span class='gray'>(defaults)</span>
  1198. </code>
  1199. </a>
  1200. </h3>
  1201. <p>Represents an at-rule.</p>
  1202. <p>If it’s followed in the CSS by a {} block, this node will have
  1203. a nodes property representing its children.</p>
  1204. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1205. <thead class='fill-light'>
  1206. <th class='col-3 small caps quiet'>parameter</th>
  1207. <th class='col-3 small caps quiet'>type</th>
  1208. <th class='col-6 small caps quiet'>description</th>
  1209. </thead>
  1210. <tr>
  1211. <td class='col-3 strong'><code>defaults</code></td>
  1212. <td class='col-3 quiet'>
  1213. any
  1214. </td>
  1215. <td class='col-6'></td>
  1216. </tr>
  1217. </table>
  1218. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1219. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'@charset "UTF-8"; @media print {}'</span>)
  1220. <span class="hljs-keyword">const</span> charset = root.first
  1221. charset.type <span class="hljs-comment">//=&gt; 'atrule'</span>
  1222. charset.nodes <span class="hljs-comment">//=&gt; undefined</span>
  1223. <span class="hljs-keyword">const</span> media = root.last
  1224. media.nodes <span class="hljs-comment">//=&gt; []</span></code></pre>
  1225. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  1226. <div class="section-indent">
  1227. <section id='atruleappend'class='mt2 mb2 px3 py1 keyline-top'>
  1228. <div class='right py2'>
  1229. <span class="px2"></span>
  1230. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L322-L331'>
  1231. <span>lib/container.js</span>
  1232. </a>
  1233. </div>
  1234. <h3 class='regular'>
  1235. <a class='black' href='#atruleappend'>
  1236. <code>
  1237. append
  1238. <span class='gray'>(children)</span>
  1239. </code>
  1240. </a>
  1241. </h3>
  1242. <p>Inserts new nodes to the end of the container.</p>
  1243. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1244. <thead class='fill-light'>
  1245. <th class='col-3 small caps quiet'>parameter</th>
  1246. <th class='col-3 small caps quiet'>type</th>
  1247. <th class='col-6 small caps quiet'>description</th>
  1248. </thead>
  1249. <tr>
  1250. <td class='col-3 strong'><code>children</code></td>
  1251. <td class='col-3 quiet'>
  1252. ...(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  1253. </td>
  1254. <td class='col-6'>New nodes.
  1255. </td>
  1256. </tr>
  1257. </table>
  1258. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1259. <code><a href="#node">Node</a></code>
  1260. :
  1261. <span class='force-inline'>This node for methods chain.
  1262. </span>
  1263. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1264. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> decl1 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  1265. <span class="hljs-keyword">const</span> decl2 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'background-color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'white'</span> })
  1266. rule.append(decl1, decl2)
  1267. root.append({ <span class="hljs-attr">name</span>: <span class="hljs-string">'charset'</span>, <span class="hljs-attr">params</span>: <span class="hljs-string">'"UTF-8"'</span> }) <span class="hljs-comment">// at-rule</span>
  1268. root.append({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }) <span class="hljs-comment">// rule</span>
  1269. rule.append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> }) <span class="hljs-comment">// declaration</span>
  1270. rule.append({ <span class="hljs-attr">text</span>: <span class="hljs-string">'Comment'</span> }) <span class="hljs-comment">// comment</span>
  1271. root.append(<span class="hljs-string">'a {}'</span>)
  1272. root.first.append(<span class="hljs-string">'color: black; z-index: 1'</span>)</code></pre>
  1273. </section>
  1274. <section id='atruleeach'class='mt2 mb2 px3 py1 keyline-top'>
  1275. <div class='right py2'>
  1276. <span class="px2"></span>
  1277. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L63-L89'>
  1278. <span>lib/container.js</span>
  1279. </a>
  1280. </div>
  1281. <h3 class='regular'>
  1282. <a class='black' href='#atruleeach'>
  1283. <code>
  1284. each
  1285. <span class='gray'>(callback)</span>
  1286. </code>
  1287. </a>
  1288. </h3>
  1289. <p>Iterates through the container’s immediate children,
  1290. calling <code>callback</code> for each child.</p>
  1291. <p>Returning <code>false</code> in the callback will break iteration.</p>
  1292. <p>This method only iterates through the container’s immediate children.
  1293. If you need to recursively iterate through all the container’s descendant
  1294. nodes, use <a href="#containerwalk">Container#walk</a>.</p>
  1295. <p>Unlike the for <code>{}</code>-cycle or <code>Array#forEach</code> this iterator is safe
  1296. if you are mutating the array of child nodes during iteration.
  1297. PostCSS will adjust the current index to match the mutations.</p>
  1298. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1299. <thead class='fill-light'>
  1300. <th class='col-3 small caps quiet'>parameter</th>
  1301. <th class='col-3 small caps quiet'>type</th>
  1302. <th class='col-6 small caps quiet'>description</th>
  1303. </thead>
  1304. <tr>
  1305. <td class='col-3 strong'><code>callback</code></td>
  1306. <td class='col-3 quiet'>
  1307. <a href="#childiterator">childIterator</a>
  1308. </td>
  1309. <td class='col-6'>Iterator receives each node and index.
  1310. </td>
  1311. </tr>
  1312. </table>
  1313. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1314. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  1315. :
  1316. <span class='force-inline'>Returns
  1317. <code>false</code>
  1318. if iteration was broke.
  1319. </span>
  1320. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1321. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a { color: black; z-index: 1 }'</span>)
  1322. <span class="hljs-keyword">const</span> rule = root.first
  1323. <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> decl <span class="hljs-keyword">of</span> rule.nodes) {
  1324. decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop })
  1325. <span class="hljs-comment">// Cycle will be infinite, because cloneBefore moves the current node</span>
  1326. <span class="hljs-comment">// to the next index</span>
  1327. }
  1328. rule.each(<span class="hljs-function"><span class="hljs-params">decl</span> =&gt;</span> {
  1329. decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop })
  1330. <span class="hljs-comment">// Will be executed only for color and z-index</span>
  1331. })</code></pre>
  1332. </section>
  1333. <section id='atruleevery'class='mt2 mb2 px3 py1 keyline-top'>
  1334. <div class='right py2'>
  1335. <span class="px2"></span>
  1336. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L539-L541'>
  1337. <span>lib/container.js</span>
  1338. </a>
  1339. </div>
  1340. <h3 class='regular'>
  1341. <a class='black' href='#atruleevery'>
  1342. <code>
  1343. every
  1344. <span class='gray'>(condition)</span>
  1345. </code>
  1346. </a>
  1347. </h3>
  1348. <p>Returns <code>true</code> if callback returns <code>true</code>
  1349. for all of the container’s children.</p>
  1350. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1351. <thead class='fill-light'>
  1352. <th class='col-3 small caps quiet'>parameter</th>
  1353. <th class='col-3 small caps quiet'>type</th>
  1354. <th class='col-6 small caps quiet'>description</th>
  1355. </thead>
  1356. <tr>
  1357. <td class='col-3 strong'><code>condition</code></td>
  1358. <td class='col-3 quiet'>
  1359. <a href="#childcondition">childCondition</a>
  1360. </td>
  1361. <td class='col-6'>Iterator returns true or false.
  1362. </td>
  1363. </tr>
  1364. </table>
  1365. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1366. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  1367. :
  1368. <span class='force-inline'>Is every child pass condition.
  1369. </span>
  1370. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1371. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> noPrefixes = rule.every(<span class="hljs-function"><span class="hljs-params">i</span> =&gt;</span> i.prop[<span class="hljs-number">0</span>] !== <span class="hljs-string">'-'</span>)</code></pre>
  1372. </section>
  1373. <section id='atrulefirst'class='mt2 mb2 px3 py1 keyline-top'>
  1374. <div class='right py2'>
  1375. <span class="px2"></span>
  1376. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L582-L585'>
  1377. <span>lib/container.js</span>
  1378. </a>
  1379. </div>
  1380. <h3 class='regular'>
  1381. <a class='black' href='#atrulefirst'>
  1382. <code>
  1383. first
  1384. <span class='gray'>()</span>
  1385. </code>
  1386. </a>
  1387. </h3>
  1388. <p>The container’s first child.</p>
  1389. <p>
  1390. Type:
  1391. <a href="#node">Node</a>
  1392. </p>
  1393. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1394. <pre class='p1 overflow-auto round fill-light'><code>rule.first === rules.nodes[<span class="hljs-number">0</span>]</code></pre>
  1395. </section>
  1396. <section id='atruleindex'class='mt2 mb2 px3 py1 keyline-top'>
  1397. <div class='right py2'>
  1398. <span class="px2"></span>
  1399. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L568-L572'>
  1400. <span>lib/container.js</span>
  1401. </a>
  1402. </div>
  1403. <h3 class='regular'>
  1404. <a class='black' href='#atruleindex'>
  1405. <code>
  1406. index
  1407. <span class='gray'>(child)</span>
  1408. </code>
  1409. </a>
  1410. </h3>
  1411. <p>Returns a <code>child</code>’s index within the <a href="Container#nodes">Container#nodes</a> array.</p>
  1412. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1413. <thead class='fill-light'>
  1414. <th class='col-3 small caps quiet'>parameter</th>
  1415. <th class='col-3 small caps quiet'>type</th>
  1416. <th class='col-6 small caps quiet'>description</th>
  1417. </thead>
  1418. <tr>
  1419. <td class='col-3 strong'><code>child</code></td>
  1420. <td class='col-3 quiet'>
  1421. <a href="#node">Node</a>
  1422. </td>
  1423. <td class='col-6'>Child of the current container.
  1424. </td>
  1425. </tr>
  1426. </table>
  1427. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1428. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
  1429. :
  1430. <span class='force-inline'>Child index.
  1431. </span>
  1432. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1433. <pre class='p1 overflow-auto round fill-light'><code>rule.index( rule.nodes[<span class="hljs-number">2</span>] ) <span class="hljs-comment">//=&gt; 2</span></code></pre>
  1434. </section>
  1435. <section id='atruleinsertafter'class='mt2 mb2 px3 py1 keyline-top'>
  1436. <div class='right py2'>
  1437. <span class="px2"></span>
  1438. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L414-L431'>
  1439. <span>lib/container.js</span>
  1440. </a>
  1441. </div>
  1442. <h3 class='regular'>
  1443. <a class='black' href='#atruleinsertafter'>
  1444. <code>
  1445. insertAfter
  1446. <span class='gray'>(exist, add)</span>
  1447. </code>
  1448. </a>
  1449. </h3>
  1450. <p>Insert new node after old node within the container.</p>
  1451. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1452. <thead class='fill-light'>
  1453. <th class='col-3 small caps quiet'>parameter</th>
  1454. <th class='col-3 small caps quiet'>type</th>
  1455. <th class='col-6 small caps quiet'>description</th>
  1456. </thead>
  1457. <tr>
  1458. <td class='col-3 strong'><code>exist</code></td>
  1459. <td class='col-3 quiet'>
  1460. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  1461. </td>
  1462. <td class='col-6'>Child or child’s index.
  1463. </td>
  1464. </tr>
  1465. <tr>
  1466. <td class='col-3 strong'><code>add</code></td>
  1467. <td class='col-3 quiet'>
  1468. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  1469. </td>
  1470. <td class='col-6'>New node.
  1471. </td>
  1472. </tr>
  1473. </table>
  1474. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1475. <code><a href="#node">Node</a></code>
  1476. :
  1477. <span class='force-inline'>This node for methods chain.
  1478. </span>
  1479. </section>
  1480. <section id='atruleinsertbefore'class='mt2 mb2 px3 py1 keyline-top'>
  1481. <div class='right py2'>
  1482. <span class="px2"></span>
  1483. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L386-L404'>
  1484. <span>lib/container.js</span>
  1485. </a>
  1486. </div>
  1487. <h3 class='regular'>
  1488. <a class='black' href='#atruleinsertbefore'>
  1489. <code>
  1490. insertBefore
  1491. <span class='gray'>(exist, add)</span>
  1492. </code>
  1493. </a>
  1494. </h3>
  1495. <p>Insert new node before old node within the container.</p>
  1496. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1497. <thead class='fill-light'>
  1498. <th class='col-3 small caps quiet'>parameter</th>
  1499. <th class='col-3 small caps quiet'>type</th>
  1500. <th class='col-6 small caps quiet'>description</th>
  1501. </thead>
  1502. <tr>
  1503. <td class='col-3 strong'><code>exist</code></td>
  1504. <td class='col-3 quiet'>
  1505. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  1506. </td>
  1507. <td class='col-6'>Child or child’s index.
  1508. </td>
  1509. </tr>
  1510. <tr>
  1511. <td class='col-3 strong'><code>add</code></td>
  1512. <td class='col-3 quiet'>
  1513. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  1514. </td>
  1515. <td class='col-6'>New node.
  1516. </td>
  1517. </tr>
  1518. </table>
  1519. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1520. <code><a href="#node">Node</a></code>
  1521. :
  1522. <span class='force-inline'>This node for methods chain.
  1523. </span>
  1524. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1525. <pre class='p1 overflow-auto round fill-light'><code>rule.insertBefore(decl, decl.clone({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop }))</code></pre>
  1526. </section>
  1527. <section id='atrulelast'class='mt2 mb2 px3 py1 keyline-top'>
  1528. <div class='right py2'>
  1529. <span class="px2"></span>
  1530. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L595-L598'>
  1531. <span>lib/container.js</span>
  1532. </a>
  1533. </div>
  1534. <h3 class='regular'>
  1535. <a class='black' href='#atrulelast'>
  1536. <code>
  1537. last
  1538. <span class='gray'>()</span>
  1539. </code>
  1540. </a>
  1541. </h3>
  1542. <p>The container’s last child.</p>
  1543. <p>
  1544. Type:
  1545. <a href="#node">Node</a>
  1546. </p>
  1547. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1548. <pre class='p1 overflow-auto round fill-light'><code>rule.last === rule.nodes[rule.nodes.length - <span class="hljs-number">1</span>]</code></pre>
  1549. </section>
  1550. <section id='atruleprepend'class='mt2 mb2 px3 py1 keyline-top'>
  1551. <div class='right py2'>
  1552. <span class="px2"></span>
  1553. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L353-L366'>
  1554. <span>lib/container.js</span>
  1555. </a>
  1556. </div>
  1557. <h3 class='regular'>
  1558. <a class='black' href='#atruleprepend'>
  1559. <code>
  1560. prepend
  1561. <span class='gray'>(children)</span>
  1562. </code>
  1563. </a>
  1564. </h3>
  1565. <p>Inserts new nodes to the start of the container.</p>
  1566. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1567. <thead class='fill-light'>
  1568. <th class='col-3 small caps quiet'>parameter</th>
  1569. <th class='col-3 small caps quiet'>type</th>
  1570. <th class='col-6 small caps quiet'>description</th>
  1571. </thead>
  1572. <tr>
  1573. <td class='col-3 strong'><code>children</code></td>
  1574. <td class='col-3 quiet'>
  1575. ...(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  1576. </td>
  1577. <td class='col-6'>New nodes.
  1578. </td>
  1579. </tr>
  1580. </table>
  1581. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1582. <code><a href="#node">Node</a></code>
  1583. :
  1584. <span class='force-inline'>This node for methods chain.
  1585. </span>
  1586. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1587. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> decl1 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  1588. <span class="hljs-keyword">const</span> decl2 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'background-color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'white'</span> })
  1589. rule.prepend(decl1, decl2)
  1590. root.append({ <span class="hljs-attr">name</span>: <span class="hljs-string">'charset'</span>, <span class="hljs-attr">params</span>: <span class="hljs-string">'"UTF-8"'</span> }) <span class="hljs-comment">// at-rule</span>
  1591. root.append({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }) <span class="hljs-comment">// rule</span>
  1592. rule.append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> }) <span class="hljs-comment">// declaration</span>
  1593. rule.append({ <span class="hljs-attr">text</span>: <span class="hljs-string">'Comment'</span> }) <span class="hljs-comment">// comment</span>
  1594. root.append(<span class="hljs-string">'a {}'</span>)
  1595. root.first.append(<span class="hljs-string">'color: black; z-index: 1'</span>)</code></pre>
  1596. </section>
  1597. <section id='atruleremoveall'class='mt2 mb2 px3 py1 keyline-top'>
  1598. <div class='right py2'>
  1599. <span class="px2"></span>
  1600. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L475-L482'>
  1601. <span>lib/container.js</span>
  1602. </a>
  1603. </div>
  1604. <h3 class='regular'>
  1605. <a class='black' href='#atruleremoveall'>
  1606. <code>
  1607. removeAll
  1608. <span class='gray'>()</span>
  1609. </code>
  1610. </a>
  1611. </h3>
  1612. <p>Removes all children from the container
  1613. and cleans their parent properties.</p>
  1614. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1615. <code><a href="#node">Node</a></code>
  1616. :
  1617. <span class='force-inline'>This node for methods chain.
  1618. </span>
  1619. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1620. <pre class='p1 overflow-auto round fill-light'><code>rule.removeAll()
  1621. rule.nodes.length <span class="hljs-comment">//=&gt; 0</span></code></pre>
  1622. </section>
  1623. <section id='atruleremovechild'class='mt2 mb2 px3 py1 keyline-top'>
  1624. <div class='right py2'>
  1625. <span class="px2"></span>
  1626. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L447-L463'>
  1627. <span>lib/container.js</span>
  1628. </a>
  1629. </div>
  1630. <h3 class='regular'>
  1631. <a class='black' href='#atruleremovechild'>
  1632. <code>
  1633. removeChild
  1634. <span class='gray'>(child)</span>
  1635. </code>
  1636. </a>
  1637. </h3>
  1638. <p>Removes node from the container and cleans the parent properties
  1639. from the node and its children.</p>
  1640. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1641. <thead class='fill-light'>
  1642. <th class='col-3 small caps quiet'>parameter</th>
  1643. <th class='col-3 small caps quiet'>type</th>
  1644. <th class='col-6 small caps quiet'>description</th>
  1645. </thead>
  1646. <tr>
  1647. <td class='col-3 strong'><code>child</code></td>
  1648. <td class='col-3 quiet'>
  1649. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  1650. </td>
  1651. <td class='col-6'>Child or child’s index.
  1652. </td>
  1653. </tr>
  1654. </table>
  1655. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1656. <code><a href="#node">Node</a></code>
  1657. :
  1658. <span class='force-inline'>This node for methods chain
  1659. </span>
  1660. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1661. <pre class='p1 overflow-auto round fill-light'><code>rule.nodes.length <span class="hljs-comment">//=&gt; 5</span>
  1662. rule.removeChild(decl)
  1663. rule.nodes.length <span class="hljs-comment">//=&gt; 4</span>
  1664. decl.parent <span class="hljs-comment">//=&gt; undefined</span></code></pre>
  1665. </section>
  1666. <section id='atrulereplacevalues'class='mt2 mb2 px3 py1 keyline-top'>
  1667. <div class='right py2'>
  1668. <span class="px2"></span>
  1669. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L510-L526'>
  1670. <span>lib/container.js</span>
  1671. </a>
  1672. </div>
  1673. <h3 class='regular'>
  1674. <a class='black' href='#atrulereplacevalues'>
  1675. <code>
  1676. replaceValues
  1677. <span class='gray'>(pattern, opts, callback)</span>
  1678. </code>
  1679. </a>
  1680. </h3>
  1681. <p>Passes all declaration values within the container that match pattern
  1682. through callback, replacing those values with the returned result
  1683. of callback.</p>
  1684. <p>This method is useful if you are using a custom unit or function
  1685. and need to iterate through all values.</p>
  1686. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1687. <thead class='fill-light'>
  1688. <th class='col-3 small caps quiet'>parameter</th>
  1689. <th class='col-3 small caps quiet'>type</th>
  1690. <th class='col-6 small caps quiet'>description</th>
  1691. </thead>
  1692. <tr>
  1693. <td class='col-3 strong'><code>pattern</code></td>
  1694. <td class='col-3 quiet'>
  1695. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)
  1696. </td>
  1697. <td class='col-6'>Replace pattern.
  1698. </td>
  1699. </tr>
  1700. <tr>
  1701. <td class='col-3 strong'><code>opts</code></td>
  1702. <td class='col-3 quiet'>
  1703. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  1704. </td>
  1705. <td class='col-6'>Options to speed up the search.
  1706. </td>
  1707. </tr>
  1708. <tr>
  1709. <td class='col-2 strong'>opts.props</td>
  1710. <td class="col-2 quiet">
  1711. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>)
  1712. </td>
  1713. <td class='col-8'>An array of property names.
  1714. </td>
  1715. </tr>
  1716. <tr>
  1717. <td class='col-2 strong'>opts.fast</td>
  1718. <td class="col-2 quiet">
  1719. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  1720. </td>
  1721. <td class='col-8'>String that’s used to narrow down
  1722. values and speed up the regexp search.
  1723. </td>
  1724. </tr>
  1725. <tr>
  1726. <td class='col-3 strong'><code>callback</code></td>
  1727. <td class='col-3 quiet'>
  1728. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)
  1729. </td>
  1730. <td class='col-6'>String to replace pattern or callback
  1731. that returns a new value. The callback
  1732. will receive the same arguments
  1733. as those passed to a function parameter
  1734. of
  1735. <code>String#replace</code>
  1736. .
  1737. </td>
  1738. </tr>
  1739. </table>
  1740. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1741. <code><a href="#node">Node</a></code>
  1742. :
  1743. <span class='force-inline'>This node for methods chain.
  1744. </span>
  1745. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1746. <pre class='p1 overflow-auto round fill-light'><code>root.replaceValues(<span class="hljs-regexp">/\d+rem/</span>, { <span class="hljs-attr">fast</span>: <span class="hljs-string">'rem'</span> }, string =&gt; {
  1747. <span class="hljs-keyword">return</span> <span class="hljs-number">15</span> * <span class="hljs-built_in">parseInt</span>(string) + <span class="hljs-string">'px'</span>
  1748. })</code></pre>
  1749. </section>
  1750. <section id='atrulesome'class='mt2 mb2 px3 py1 keyline-top'>
  1751. <div class='right py2'>
  1752. <span class="px2"></span>
  1753. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L554-L556'>
  1754. <span>lib/container.js</span>
  1755. </a>
  1756. </div>
  1757. <h3 class='regular'>
  1758. <a class='black' href='#atrulesome'>
  1759. <code>
  1760. some
  1761. <span class='gray'>(condition)</span>
  1762. </code>
  1763. </a>
  1764. </h3>
  1765. <p>Returns <code>true</code> if callback returns <code>true</code> for (at least) one
  1766. of the container’s children.</p>
  1767. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1768. <thead class='fill-light'>
  1769. <th class='col-3 small caps quiet'>parameter</th>
  1770. <th class='col-3 small caps quiet'>type</th>
  1771. <th class='col-6 small caps quiet'>description</th>
  1772. </thead>
  1773. <tr>
  1774. <td class='col-3 strong'><code>condition</code></td>
  1775. <td class='col-3 quiet'>
  1776. <a href="#childcondition">childCondition</a>
  1777. </td>
  1778. <td class='col-6'>Iterator returns true or false.
  1779. </td>
  1780. </tr>
  1781. </table>
  1782. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1783. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  1784. :
  1785. <span class='force-inline'>Is some child pass condition.
  1786. </span>
  1787. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1788. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> hasPrefix = rule.some(<span class="hljs-function"><span class="hljs-params">i</span> =&gt;</span> i.prop[<span class="hljs-number">0</span>] === <span class="hljs-string">'-'</span>)</code></pre>
  1789. </section>
  1790. <section id='atrulewalk'class='mt2 mb2 px3 py1 keyline-top'>
  1791. <div class='right py2'>
  1792. <span class="px2"></span>
  1793. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L110-L124'>
  1794. <span>lib/container.js</span>
  1795. </a>
  1796. </div>
  1797. <h3 class='regular'>
  1798. <a class='black' href='#atrulewalk'>
  1799. <code>
  1800. walk
  1801. <span class='gray'>(callback)</span>
  1802. </code>
  1803. </a>
  1804. </h3>
  1805. <p>Traverses the container’s descendant nodes, calling callback
  1806. for each node.</p>
  1807. <p>Like container.each(), this method is safe to use
  1808. if you are mutating arrays during iteration.</p>
  1809. <p>If you only need to iterate through the container’s immediate children,
  1810. use <a href="#containereach">Container#each</a>.</p>
  1811. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1812. <thead class='fill-light'>
  1813. <th class='col-3 small caps quiet'>parameter</th>
  1814. <th class='col-3 small caps quiet'>type</th>
  1815. <th class='col-6 small caps quiet'>description</th>
  1816. </thead>
  1817. <tr>
  1818. <td class='col-3 strong'><code>callback</code></td>
  1819. <td class='col-3 quiet'>
  1820. <a href="#childiterator">childIterator</a>
  1821. </td>
  1822. <td class='col-6'>Iterator receives each node and index.
  1823. </td>
  1824. </tr>
  1825. </table>
  1826. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1827. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  1828. :
  1829. <span class='force-inline'>Returns
  1830. <code>false</code>
  1831. if iteration was broke.
  1832. </span>
  1833. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1834. <pre class='p1 overflow-auto round fill-light'><code>root.walk(<span class="hljs-function"><span class="hljs-params">node</span> =&gt;</span> {
  1835. <span class="hljs-comment">// Traverses all descendant nodes.</span>
  1836. })</code></pre>
  1837. </section>
  1838. <section id='atrulewalkatrules'class='mt2 mb2 px3 py1 keyline-top'>
  1839. <div class='right py2'>
  1840. <span class="px2"></span>
  1841. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L255-L276'>
  1842. <span>lib/container.js</span>
  1843. </a>
  1844. </div>
  1845. <h3 class='regular'>
  1846. <a class='black' href='#atrulewalkatrules'>
  1847. <code>
  1848. walkAtRules
  1849. <span class='gray'>(name?, callback)</span>
  1850. </code>
  1851. </a>
  1852. </h3>
  1853. <p>Traverses the container’s descendant nodes, calling callback
  1854. for each at-rule node.</p>
  1855. <p>If you pass a filter, iteration will only happen over at-rules
  1856. that have matching names.</p>
  1857. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  1858. to use if you are mutating arrays during iteration.</p>
  1859. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1860. <thead class='fill-light'>
  1861. <th class='col-3 small caps quiet'>parameter</th>
  1862. <th class='col-3 small caps quiet'>type</th>
  1863. <th class='col-6 small caps quiet'>description</th>
  1864. </thead>
  1865. <tr>
  1866. <td class='col-3 strong'><code>name</code></td>
  1867. <td class='col-3 quiet'>
  1868. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  1869. </td>
  1870. <td class='col-6'>String or regular expression
  1871. to filter at-rules by name.
  1872. </td>
  1873. </tr>
  1874. <tr>
  1875. <td class='col-3 strong'><code>callback</code></td>
  1876. <td class='col-3 quiet'>
  1877. <a href="#childiterator">childIterator</a>
  1878. </td>
  1879. <td class='col-6'>Iterator receives each node and index.
  1880. </td>
  1881. </tr>
  1882. </table>
  1883. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1884. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  1885. :
  1886. <span class='force-inline'>Returns
  1887. <code>false</code>
  1888. if iteration was broke.
  1889. </span>
  1890. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1891. <pre class='p1 overflow-auto round fill-light'><code>root.walkAtRules(<span class="hljs-function"><span class="hljs-params">rule</span> =&gt;</span> {
  1892. <span class="hljs-keyword">if</span> (isOld(rule.name)) rule.remove()
  1893. })
  1894. <span class="hljs-keyword">let</span> first = <span class="hljs-literal">false</span>
  1895. root.walkAtRules(<span class="hljs-string">'charset'</span>, rule =&gt; {
  1896. <span class="hljs-keyword">if</span> (!first) {
  1897. first = <span class="hljs-literal">true</span>
  1898. } <span class="hljs-keyword">else</span> {
  1899. rule.remove()
  1900. }
  1901. })</code></pre>
  1902. </section>
  1903. <section id='atrulewalkcomments'class='mt2 mb2 px3 py1 keyline-top'>
  1904. <div class='right py2'>
  1905. <span class="px2"></span>
  1906. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L294-L300'>
  1907. <span>lib/container.js</span>
  1908. </a>
  1909. </div>
  1910. <h3 class='regular'>
  1911. <a class='black' href='#atrulewalkcomments'>
  1912. <code>
  1913. walkComments
  1914. <span class='gray'>(callback)</span>
  1915. </code>
  1916. </a>
  1917. </h3>
  1918. <p>Traverses the container’s descendant nodes, calling callback
  1919. for each comment node.</p>
  1920. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  1921. to use if you are mutating arrays during iteration.</p>
  1922. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1923. <thead class='fill-light'>
  1924. <th class='col-3 small caps quiet'>parameter</th>
  1925. <th class='col-3 small caps quiet'>type</th>
  1926. <th class='col-6 small caps quiet'>description</th>
  1927. </thead>
  1928. <tr>
  1929. <td class='col-3 strong'><code>callback</code></td>
  1930. <td class='col-3 quiet'>
  1931. <a href="#childiterator">childIterator</a>
  1932. </td>
  1933. <td class='col-6'>Iterator receives each node and index.
  1934. </td>
  1935. </tr>
  1936. </table>
  1937. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1938. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  1939. :
  1940. <span class='force-inline'>Returns
  1941. <code>false</code>
  1942. if iteration was broke.
  1943. </span>
  1944. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  1945. <pre class='p1 overflow-auto round fill-light'><code>root.walkComments(<span class="hljs-function"><span class="hljs-params">comment</span> =&gt;</span> {
  1946. comment.remove()
  1947. })</code></pre>
  1948. </section>
  1949. <section id='atrulewalkdecls'class='mt2 mb2 px3 py1 keyline-top'>
  1950. <div class='right py2'>
  1951. <span class="px2"></span>
  1952. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L155-L176'>
  1953. <span>lib/container.js</span>
  1954. </a>
  1955. </div>
  1956. <h3 class='regular'>
  1957. <a class='black' href='#atrulewalkdecls'>
  1958. <code>
  1959. walkDecls
  1960. <span class='gray'>(prop?, callback)</span>
  1961. </code>
  1962. </a>
  1963. </h3>
  1964. <p>Traverses the container’s descendant nodes, calling callback
  1965. for each declaration node.</p>
  1966. <p>If you pass a filter, iteration will only happen over declarations
  1967. with matching properties.</p>
  1968. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  1969. to use if you are mutating arrays during iteration.</p>
  1970. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  1971. <thead class='fill-light'>
  1972. <th class='col-3 small caps quiet'>parameter</th>
  1973. <th class='col-3 small caps quiet'>type</th>
  1974. <th class='col-6 small caps quiet'>description</th>
  1975. </thead>
  1976. <tr>
  1977. <td class='col-3 strong'><code>prop</code></td>
  1978. <td class='col-3 quiet'>
  1979. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  1980. </td>
  1981. <td class='col-6'>String or regular expression
  1982. to filter declarations by property name.
  1983. </td>
  1984. </tr>
  1985. <tr>
  1986. <td class='col-3 strong'><code>callback</code></td>
  1987. <td class='col-3 quiet'>
  1988. <a href="#childiterator">childIterator</a>
  1989. </td>
  1990. <td class='col-6'>Iterator receives each node and index.
  1991. </td>
  1992. </tr>
  1993. </table>
  1994. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  1995. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  1996. :
  1997. <span class='force-inline'>Returns
  1998. <code>false</code>
  1999. if iteration was broke.
  2000. </span>
  2001. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2002. <pre class='p1 overflow-auto round fill-light'><code>root.walkDecls(<span class="hljs-function"><span class="hljs-params">decl</span> =&gt;</span> {
  2003. checkPropertySupport(decl.prop)
  2004. })
  2005. root.walkDecls(<span class="hljs-string">'border-radius'</span>, decl =&gt; {
  2006. decl.remove()
  2007. })
  2008. root.walkDecls(<span class="hljs-regexp">/^background/</span>, decl =&gt; {
  2009. decl.value = takeFirstColorFromGradient(decl.value)
  2010. })</code></pre>
  2011. </section>
  2012. <section id='atrulewalkrules'class='mt2 mb2 px3 py1 keyline-top'>
  2013. <div class='right py2'>
  2014. <span class="px2"></span>
  2015. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L201-L223'>
  2016. <span>lib/container.js</span>
  2017. </a>
  2018. </div>
  2019. <h3 class='regular'>
  2020. <a class='black' href='#atrulewalkrules'>
  2021. <code>
  2022. walkRules
  2023. <span class='gray'>(selector?, callback)</span>
  2024. </code>
  2025. </a>
  2026. </h3>
  2027. <p>Traverses the container’s descendant nodes, calling callback
  2028. for each rule node.</p>
  2029. <p>If you pass a filter, iteration will only happen over rules
  2030. with matching selectors.</p>
  2031. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  2032. to use if you are mutating arrays during iteration.</p>
  2033. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2034. <thead class='fill-light'>
  2035. <th class='col-3 small caps quiet'>parameter</th>
  2036. <th class='col-3 small caps quiet'>type</th>
  2037. <th class='col-6 small caps quiet'>description</th>
  2038. </thead>
  2039. <tr>
  2040. <td class='col-3 strong'><code>selector</code></td>
  2041. <td class='col-3 quiet'>
  2042. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  2043. </td>
  2044. <td class='col-6'>String or regular expression
  2045. to filter rules by selector.
  2046. </td>
  2047. </tr>
  2048. <tr>
  2049. <td class='col-3 strong'><code>callback</code></td>
  2050. <td class='col-3 quiet'>
  2051. <a href="#childiterator">childIterator</a>
  2052. </td>
  2053. <td class='col-6'>Iterator receives each node and index.
  2054. </td>
  2055. </tr>
  2056. </table>
  2057. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2058. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  2059. :
  2060. <span class='force-inline'>returns
  2061. <code>false</code>
  2062. if iteration was broke.
  2063. </span>
  2064. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2065. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> selectors = []
  2066. root.walkRules(<span class="hljs-function"><span class="hljs-params">rule</span> =&gt;</span> {
  2067. selectors.push(rule.selector)
  2068. })
  2069. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Your CSS uses <span class="hljs-subst">${ selectors.length }</span> selectors`</span>)</code></pre>
  2070. </section>
  2071. </div>
  2072. </section>
  2073. <section id='comment'class='mt2 mb2 px3 py1 keyline-top'>
  2074. <div class='right py2'>
  2075. <span class='font-smaller'>
  2076. Extends
  2077. <a href="#node">Node</a>
  2078. </span>
  2079. <span class="px2"></span>
  2080. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/comment.js#L11-L34'>
  2081. <span>lib/comment.js</span>
  2082. </a>
  2083. </div>
  2084. <h3 class='regular'>
  2085. <a class='black' href='#comment'>
  2086. <code>
  2087. Comment
  2088. <span class='gray'>(defaults)</span>
  2089. </code>
  2090. </a>
  2091. </h3>
  2092. <p>Represents a comment between declarations or statements (rule and at-rules).</p>
  2093. <p>Comments inside selectors, at-rule parameters, or declaration values
  2094. will be stored in the <code>raws</code> properties explained above.</p>
  2095. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2096. <thead class='fill-light'>
  2097. <th class='col-3 small caps quiet'>parameter</th>
  2098. <th class='col-3 small caps quiet'>type</th>
  2099. <th class='col-6 small caps quiet'>description</th>
  2100. </thead>
  2101. <tr>
  2102. <td class='col-3 strong'><code>defaults</code></td>
  2103. <td class='col-3 quiet'>
  2104. any
  2105. </td>
  2106. <td class='col-6'></td>
  2107. </tr>
  2108. </table>
  2109. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  2110. <div class="section-indent">
  2111. <section id='commentafter'class='mt2 mb2 px3 py1 keyline-top'>
  2112. <div class='right py2'>
  2113. <span class="px2"></span>
  2114. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L313-L316'>
  2115. <span>lib/node.js</span>
  2116. </a>
  2117. </div>
  2118. <h3 class='regular'>
  2119. <a class='black' href='#commentafter'>
  2120. <code>
  2121. after
  2122. <span class='gray'>(add)</span>
  2123. </code>
  2124. </a>
  2125. </h3>
  2126. <p>Insert new node after current node to current node’s parent.</p>
  2127. <p>Just alias for <code>node.parent.insertAfter(node, add)</code>.</p>
  2128. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2129. <thead class='fill-light'>
  2130. <th class='col-3 small caps quiet'>parameter</th>
  2131. <th class='col-3 small caps quiet'>type</th>
  2132. <th class='col-6 small caps quiet'>description</th>
  2133. </thead>
  2134. <tr>
  2135. <td class='col-3 strong'><code>add</code></td>
  2136. <td class='col-3 quiet'>
  2137. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  2138. </td>
  2139. <td class='col-6'>New node.
  2140. </td>
  2141. </tr>
  2142. </table>
  2143. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2144. <code><a href="#node">Node</a></code>
  2145. :
  2146. <span class='force-inline'>This node for methods chain.
  2147. </span>
  2148. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2149. <pre class='p1 overflow-auto round fill-light'><code>decl.after(<span class="hljs-string">'color: black'</span>)</code></pre>
  2150. </section>
  2151. <section id='commentbefore'class='mt2 mb2 px3 py1 keyline-top'>
  2152. <div class='right py2'>
  2153. <span class="px2"></span>
  2154. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L296-L299'>
  2155. <span>lib/node.js</span>
  2156. </a>
  2157. </div>
  2158. <h3 class='regular'>
  2159. <a class='black' href='#commentbefore'>
  2160. <code>
  2161. before
  2162. <span class='gray'>(add)</span>
  2163. </code>
  2164. </a>
  2165. </h3>
  2166. <p>Insert new node before current node to current node’s parent.</p>
  2167. <p>Just alias for <code>node.parent.insertBefore(node, add)</code>.</p>
  2168. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2169. <thead class='fill-light'>
  2170. <th class='col-3 small caps quiet'>parameter</th>
  2171. <th class='col-3 small caps quiet'>type</th>
  2172. <th class='col-6 small caps quiet'>description</th>
  2173. </thead>
  2174. <tr>
  2175. <td class='col-3 strong'><code>add</code></td>
  2176. <td class='col-3 quiet'>
  2177. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  2178. </td>
  2179. <td class='col-6'>New node.
  2180. </td>
  2181. </tr>
  2182. </table>
  2183. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2184. <code><a href="#node">Node</a></code>
  2185. :
  2186. <span class='force-inline'>This node for methods chain.
  2187. </span>
  2188. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2189. <pre class='p1 overflow-auto round fill-light'><code>decl.before(<span class="hljs-string">'content: ""'</span>)</code></pre>
  2190. </section>
  2191. <section id='commentcleanraws'class='mt2 mb2 px3 py1 keyline-top'>
  2192. <div class='right py2'>
  2193. <span class="px2"></span>
  2194. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L394-L398'>
  2195. <span>lib/node.js</span>
  2196. </a>
  2197. </div>
  2198. <h3 class='regular'>
  2199. <a class='black' href='#commentcleanraws'>
  2200. <code>
  2201. cleanRaws
  2202. <span class='gray'>(keepBetween?)</span>
  2203. </code>
  2204. </a>
  2205. </h3>
  2206. <p>Clear the code style properties for the node and its children.</p>
  2207. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2208. <thead class='fill-light'>
  2209. <th class='col-3 small caps quiet'>parameter</th>
  2210. <th class='col-3 small caps quiet'>type</th>
  2211. <th class='col-6 small caps quiet'>description</th>
  2212. </thead>
  2213. <tr>
  2214. <td class='col-3 strong'><code>keepBetween</code></td>
  2215. <td class='col-3 quiet'>
  2216. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>?
  2217. </td>
  2218. <td class='col-6'>Keep the raws.between symbols.
  2219. </td>
  2220. </tr>
  2221. </table>
  2222. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2223. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a></code>
  2224. :
  2225. <span class='force-inline'>
  2226. </span>
  2227. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2228. <pre class='p1 overflow-auto round fill-light'><code>node.raws.before <span class="hljs-comment">//=&gt; ' '</span>
  2229. node.cleanRaws()
  2230. node.raws.before <span class="hljs-comment">//=&gt; undefined</span></code></pre>
  2231. </section>
  2232. <section id='commentclone'class='mt2 mb2 px3 py1 keyline-top'>
  2233. <div class='right py2'>
  2234. <span class="px2"></span>
  2235. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L183-L189'>
  2236. <span>lib/node.js</span>
  2237. </a>
  2238. </div>
  2239. <h3 class='regular'>
  2240. <a class='black' href='#commentclone'>
  2241. <code>
  2242. clone
  2243. <span class='gray'>(overrides = {})</span>
  2244. </code>
  2245. </a>
  2246. </h3>
  2247. <p>Returns an exact clone of the node.</p>
  2248. <p>The resulting cloned node and its (cloned) children will retain
  2249. code style properties.</p>
  2250. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2251. <thead class='fill-light'>
  2252. <th class='col-3 small caps quiet'>parameter</th>
  2253. <th class='col-3 small caps quiet'>type</th>
  2254. <th class='col-6 small caps quiet'>description</th>
  2255. </thead>
  2256. <tr>
  2257. <td class='col-3 strong'><code>overrides</code></td>
  2258. <td class='col-3 quiet'>
  2259. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  2260. = <code>{}</code>
  2261. </td>
  2262. <td class='col-6'>New properties to override in the clone.
  2263. </td>
  2264. </tr>
  2265. </table>
  2266. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2267. <code><a href="#node">Node</a></code>
  2268. :
  2269. <span class='force-inline'>Clone of the node.
  2270. </span>
  2271. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2272. <pre class='p1 overflow-auto round fill-light'><code>decl.raws.before <span class="hljs-comment">//=&gt; "\n "</span>
  2273. <span class="hljs-keyword">const</span> cloned = decl.clone({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-moz-'</span> + decl.prop })
  2274. cloned.raws.before <span class="hljs-comment">//=&gt; "\n "</span>
  2275. cloned.toString() <span class="hljs-comment">//=&gt; -moz-transform: scale(0)</span></code></pre>
  2276. </section>
  2277. <section id='commentcloneafter'class='mt2 mb2 px3 py1 keyline-top'>
  2278. <div class='right py2'>
  2279. <span class="px2"></span>
  2280. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L216-L220'>
  2281. <span>lib/node.js</span>
  2282. </a>
  2283. </div>
  2284. <h3 class='regular'>
  2285. <a class='black' href='#commentcloneafter'>
  2286. <code>
  2287. cloneAfter
  2288. <span class='gray'>(overrides = {})</span>
  2289. </code>
  2290. </a>
  2291. </h3>
  2292. <p>Shortcut to clone the node and insert the resulting cloned node
  2293. after the current node.</p>
  2294. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2295. <thead class='fill-light'>
  2296. <th class='col-3 small caps quiet'>parameter</th>
  2297. <th class='col-3 small caps quiet'>type</th>
  2298. <th class='col-6 small caps quiet'>description</th>
  2299. </thead>
  2300. <tr>
  2301. <td class='col-3 strong'><code>overrides</code></td>
  2302. <td class='col-3 quiet'>
  2303. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  2304. = <code>{}</code>
  2305. </td>
  2306. <td class='col-6'>New properties to override in the clone.
  2307. </td>
  2308. </tr>
  2309. </table>
  2310. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2311. <code><a href="#node">Node</a></code>
  2312. :
  2313. <span class='force-inline'>New node.
  2314. </span>
  2315. </section>
  2316. <section id='commentclonebefore'class='mt2 mb2 px3 py1 keyline-top'>
  2317. <div class='right py2'>
  2318. <span class="px2"></span>
  2319. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L202-L206'>
  2320. <span>lib/node.js</span>
  2321. </a>
  2322. </div>
  2323. <h3 class='regular'>
  2324. <a class='black' href='#commentclonebefore'>
  2325. <code>
  2326. cloneBefore
  2327. <span class='gray'>(overrides = {})</span>
  2328. </code>
  2329. </a>
  2330. </h3>
  2331. <p>Shortcut to clone the node and insert the resulting cloned node
  2332. before the current node.</p>
  2333. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2334. <thead class='fill-light'>
  2335. <th class='col-3 small caps quiet'>parameter</th>
  2336. <th class='col-3 small caps quiet'>type</th>
  2337. <th class='col-6 small caps quiet'>description</th>
  2338. </thead>
  2339. <tr>
  2340. <td class='col-3 strong'><code>overrides</code></td>
  2341. <td class='col-3 quiet'>
  2342. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  2343. = <code>{}</code>
  2344. </td>
  2345. <td class='col-6'>Mew properties to override in the clone.
  2346. </td>
  2347. </tr>
  2348. </table>
  2349. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2350. <code><a href="#node">Node</a></code>
  2351. :
  2352. <span class='force-inline'>New node
  2353. </span>
  2354. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2355. <pre class='p1 overflow-auto round fill-light'><code>decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-moz-'</span> + decl.prop })</code></pre>
  2356. </section>
  2357. <section id='commenterror'class='mt2 mb2 px3 py1 keyline-top'>
  2358. <div class='right py2'>
  2359. <span class="px2"></span>
  2360. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L89-L95'>
  2361. <span>lib/node.js</span>
  2362. </a>
  2363. </div>
  2364. <h3 class='regular'>
  2365. <a class='black' href='#commenterror'>
  2366. <code>
  2367. error
  2368. <span class='gray'>(message, opts = {})</span>
  2369. </code>
  2370. </a>
  2371. </h3>
  2372. <p>Returns a <code>CssSyntaxError</code> instance containing the original position
  2373. of the node in the source, showing line and column numbers and also
  2374. a small excerpt to facilitate debugging.</p>
  2375. <p>If present, an input source map will be used to get the original position
  2376. of the source, even from a previous compilation step
  2377. (e.g., from Sass compilation).</p>
  2378. <p>This method produces very useful error messages.</p>
  2379. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2380. <thead class='fill-light'>
  2381. <th class='col-3 small caps quiet'>parameter</th>
  2382. <th class='col-3 small caps quiet'>type</th>
  2383. <th class='col-6 small caps quiet'>description</th>
  2384. </thead>
  2385. <tr>
  2386. <td class='col-3 strong'><code>message</code></td>
  2387. <td class='col-3 quiet'>
  2388. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  2389. </td>
  2390. <td class='col-6'>Error description.
  2391. </td>
  2392. </tr>
  2393. <tr>
  2394. <td class='col-3 strong'><code>opts</code></td>
  2395. <td class='col-3 quiet'>
  2396. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  2397. = <code>{}</code>
  2398. </td>
  2399. <td class='col-6'>Options.
  2400. </td>
  2401. </tr>
  2402. <tr>
  2403. <td class='col-2 strong'>opts.plugin</td>
  2404. <td class="col-2 quiet">
  2405. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  2406. </td>
  2407. <td class='col-8'>Plugin name that created this error.
  2408. PostCSS will set it automatically.
  2409. </td>
  2410. </tr>
  2411. <tr>
  2412. <td class='col-2 strong'>opts.word</td>
  2413. <td class="col-2 quiet">
  2414. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  2415. </td>
  2416. <td class='col-8'>A word inside a node’s string that should
  2417. be highlighted as the source of the error.
  2418. </td>
  2419. </tr>
  2420. <tr>
  2421. <td class='col-2 strong'>opts.index</td>
  2422. <td class="col-2 quiet">
  2423. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  2424. </td>
  2425. <td class='col-8'>An index inside a node’s string that should
  2426. be highlighted as the source of the error.
  2427. </td>
  2428. </tr>
  2429. </table>
  2430. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2431. <code><a href="#csssyntaxerror">CssSyntaxError</a></code>
  2432. :
  2433. <span class='force-inline'>Error object to throw it.
  2434. </span>
  2435. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2436. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (!variables[name]) {
  2437. <span class="hljs-keyword">throw</span> decl.error(<span class="hljs-string">'Unknown variable '</span> + name, { <span class="hljs-attr">word</span>: name })
  2438. <span class="hljs-comment">// CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black</span>
  2439. <span class="hljs-comment">// color: $black</span>
  2440. <span class="hljs-comment">// a</span>
  2441. <span class="hljs-comment">// ^</span>
  2442. <span class="hljs-comment">// background: white</span>
  2443. }</code></pre>
  2444. </section>
  2445. <section id='commentnext'class='mt2 mb2 px3 py1 keyline-top'>
  2446. <div class='right py2'>
  2447. <span class="px2"></span>
  2448. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L260-L264'>
  2449. <span>lib/node.js</span>
  2450. </a>
  2451. </div>
  2452. <h3 class='regular'>
  2453. <a class='black' href='#commentnext'>
  2454. <code>
  2455. next
  2456. <span class='gray'>()</span>
  2457. </code>
  2458. </a>
  2459. </h3>
  2460. <p>Returns the next child of the node’s parent.
  2461. Returns <code>undefined</code> if the current node is the last child.</p>
  2462. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2463. <code>(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  2464. :
  2465. <span class='force-inline'>Next node.
  2466. </span>
  2467. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2468. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (comment.text === <span class="hljs-string">'delete next'</span>) {
  2469. <span class="hljs-keyword">const</span> next = comment.next()
  2470. <span class="hljs-keyword">if</span> (next) {
  2471. next.remove()
  2472. }
  2473. }</code></pre>
  2474. </section>
  2475. <section id='commentprev'class='mt2 mb2 px3 py1 keyline-top'>
  2476. <div class='right py2'>
  2477. <span class="px2"></span>
  2478. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L278-L282'>
  2479. <span>lib/node.js</span>
  2480. </a>
  2481. </div>
  2482. <h3 class='regular'>
  2483. <a class='black' href='#commentprev'>
  2484. <code>
  2485. prev
  2486. <span class='gray'>()</span>
  2487. </code>
  2488. </a>
  2489. </h3>
  2490. <p>Returns the previous child of the node’s parent.
  2491. Returns <code>undefined</code> if the current node is the first child.</p>
  2492. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2493. <code>(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  2494. :
  2495. <span class='force-inline'>Previous node.
  2496. </span>
  2497. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2498. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> annotation = decl.prev()
  2499. <span class="hljs-keyword">if</span> (annotation.type === <span class="hljs-string">'comment'</span>) {
  2500. readAnnotation(annotation.text)
  2501. }</code></pre>
  2502. </section>
  2503. <section id='commentraw'class='mt2 mb2 px3 py1 keyline-top'>
  2504. <div class='right py2'>
  2505. <span class="px2"></span>
  2506. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L363-L366'>
  2507. <span>lib/node.js</span>
  2508. </a>
  2509. </div>
  2510. <h3 class='regular'>
  2511. <a class='black' href='#commentraw'>
  2512. <code>
  2513. raw
  2514. <span class='gray'>(prop, defaultType?)</span>
  2515. </code>
  2516. </a>
  2517. </h3>
  2518. <p>Returns a <a href="Node#raws">Node#raws</a> value. If the node is missing
  2519. the code style property (because the node was manually built or cloned),
  2520. PostCSS will try to autodetect the code style property by looking
  2521. at other nodes in the tree.</p>
  2522. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2523. <thead class='fill-light'>
  2524. <th class='col-3 small caps quiet'>parameter</th>
  2525. <th class='col-3 small caps quiet'>type</th>
  2526. <th class='col-6 small caps quiet'>description</th>
  2527. </thead>
  2528. <tr>
  2529. <td class='col-3 strong'><code>prop</code></td>
  2530. <td class='col-3 quiet'>
  2531. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  2532. </td>
  2533. <td class='col-6'>Name of code style property.
  2534. </td>
  2535. </tr>
  2536. <tr>
  2537. <td class='col-3 strong'><code>defaultType</code></td>
  2538. <td class='col-3 quiet'>
  2539. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>?
  2540. </td>
  2541. <td class='col-6'>Name of default value, it can be missed
  2542. if the value is the same as prop.
  2543. </td>
  2544. </tr>
  2545. </table>
  2546. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2547. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  2548. :
  2549. <span class='force-inline'>Code style value.
  2550. </span>
  2551. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2552. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a { background: white }'</span>)
  2553. root.nodes[<span class="hljs-number">0</span>].append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  2554. root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">1</span>].raws.before <span class="hljs-comment">//=&gt; undefined</span>
  2555. root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">1</span>].raw(<span class="hljs-string">'before'</span>) <span class="hljs-comment">//=&gt; ' '</span></code></pre>
  2556. </section>
  2557. <section id='commentremove'class='mt2 mb2 px3 py1 keyline-top'>
  2558. <div class='right py2'>
  2559. <span class="px2"></span>
  2560. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L139-L145'>
  2561. <span>lib/node.js</span>
  2562. </a>
  2563. </div>
  2564. <h3 class='regular'>
  2565. <a class='black' href='#commentremove'>
  2566. <code>
  2567. remove
  2568. <span class='gray'>()</span>
  2569. </code>
  2570. </a>
  2571. </h3>
  2572. <p>Removes the node from its parent and cleans the parent properties
  2573. from the node and its children.</p>
  2574. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2575. <code><a href="#node">Node</a></code>
  2576. :
  2577. <span class='force-inline'>Node to make calls chain.
  2578. </span>
  2579. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2580. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (decl.prop.match(<span class="hljs-regexp">/^-webkit-/</span>)) {
  2581. decl.remove()
  2582. }</code></pre>
  2583. </section>
  2584. <section id='commentreplacewith'class='mt2 mb2 px3 py1 keyline-top'>
  2585. <div class='right py2'>
  2586. <span class="px2"></span>
  2587. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L234-L244'>
  2588. <span>lib/node.js</span>
  2589. </a>
  2590. </div>
  2591. <h3 class='regular'>
  2592. <a class='black' href='#commentreplacewith'>
  2593. <code>
  2594. replaceWith
  2595. <span class='gray'>(nodes)</span>
  2596. </code>
  2597. </a>
  2598. </h3>
  2599. <p>Inserts node(s) before the current node and removes the current node.</p>
  2600. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2601. <thead class='fill-light'>
  2602. <th class='col-3 small caps quiet'>parameter</th>
  2603. <th class='col-3 small caps quiet'>type</th>
  2604. <th class='col-6 small caps quiet'>description</th>
  2605. </thead>
  2606. <tr>
  2607. <td class='col-3 strong'><code>nodes</code></td>
  2608. <td class='col-3 quiet'>
  2609. ...<a href="#node">Node</a>
  2610. </td>
  2611. <td class='col-6'>Mode(s) to replace current one.
  2612. </td>
  2613. </tr>
  2614. </table>
  2615. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2616. <code><a href="#node">Node</a></code>
  2617. :
  2618. <span class='force-inline'>Current node to methods chain.
  2619. </span>
  2620. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2621. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (atrule.name === <span class="hljs-string">'mixin'</span>) {
  2622. atrule.replaceWith(mixinRules[atrule.params])
  2623. }</code></pre>
  2624. </section>
  2625. <section id='commentroot'class='mt2 mb2 px3 py1 keyline-top'>
  2626. <div class='right py2'>
  2627. <span class="px2"></span>
  2628. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L376-L380'>
  2629. <span>lib/node.js</span>
  2630. </a>
  2631. </div>
  2632. <h3 class='regular'>
  2633. <a class='black' href='#commentroot'>
  2634. <code>
  2635. root
  2636. <span class='gray'>()</span>
  2637. </code>
  2638. </a>
  2639. </h3>
  2640. <p>Finds the Root instance of the node’s tree.</p>
  2641. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2642. <code><a href="#root">Root</a></code>
  2643. :
  2644. <span class='force-inline'>Root parent.
  2645. </span>
  2646. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2647. <pre class='p1 overflow-auto round fill-light'><code>root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">0</span>].root() === root</code></pre>
  2648. </section>
  2649. <section id='commenttostring'class='mt2 mb2 px3 py1 keyline-top'>
  2650. <div class='right py2'>
  2651. <span class="px2"></span>
  2652. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L158-L165'>
  2653. <span>lib/node.js</span>
  2654. </a>
  2655. </div>
  2656. <h3 class='regular'>
  2657. <a class='black' href='#commenttostring'>
  2658. <code>
  2659. toString
  2660. <span class='gray'>(stringifier = stringify)</span>
  2661. </code>
  2662. </a>
  2663. </h3>
  2664. <p>Returns a CSS string representing the node.</p>
  2665. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2666. <thead class='fill-light'>
  2667. <th class='col-3 small caps quiet'>parameter</th>
  2668. <th class='col-3 small caps quiet'>type</th>
  2669. <th class='col-6 small caps quiet'>description</th>
  2670. </thead>
  2671. <tr>
  2672. <td class='col-3 strong'><code>stringifier</code></td>
  2673. <td class='col-3 quiet'>
  2674. (<a href="#stringifier">stringifier</a> | <a href="#syntax">syntax</a>)?
  2675. = <code>stringify</code>
  2676. </td>
  2677. <td class='col-6'>A syntax to use
  2678. in string generation.
  2679. </td>
  2680. </tr>
  2681. </table>
  2682. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2683. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  2684. :
  2685. <span class='force-inline'>CSS string of this node.
  2686. </span>
  2687. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2688. <pre class='p1 overflow-auto round fill-light'><code>postcss.rule({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }).toString() <span class="hljs-comment">//=&gt; "a {}"</span></code></pre>
  2689. </section>
  2690. <section id='commentwarn'class='mt2 mb2 px3 py1 keyline-top'>
  2691. <div class='right py2'>
  2692. <span class="px2"></span>
  2693. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L122-L126'>
  2694. <span>lib/node.js</span>
  2695. </a>
  2696. </div>
  2697. <h3 class='regular'>
  2698. <a class='black' href='#commentwarn'>
  2699. <code>
  2700. warn
  2701. <span class='gray'>(result, text, opts?)</span>
  2702. </code>
  2703. </a>
  2704. </h3>
  2705. <p>This method is provided as a convenience wrapper for <a href="#resultwarn">Result#warn</a>.</p>
  2706. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2707. <thead class='fill-light'>
  2708. <th class='col-3 small caps quiet'>parameter</th>
  2709. <th class='col-3 small caps quiet'>type</th>
  2710. <th class='col-6 small caps quiet'>description</th>
  2711. </thead>
  2712. <tr>
  2713. <td class='col-3 strong'><code>result</code></td>
  2714. <td class='col-3 quiet'>
  2715. <a href="#result">Result</a>
  2716. </td>
  2717. <td class='col-6'>The
  2718. <a href="#result">Result</a>
  2719. instance
  2720. that will receive the warning.
  2721. </td>
  2722. </tr>
  2723. <tr>
  2724. <td class='col-3 strong'><code>text</code></td>
  2725. <td class='col-3 quiet'>
  2726. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  2727. </td>
  2728. <td class='col-6'>Warning message.
  2729. </td>
  2730. </tr>
  2731. <tr>
  2732. <td class='col-3 strong'><code>opts</code></td>
  2733. <td class='col-3 quiet'>
  2734. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  2735. </td>
  2736. <td class='col-6'>Options
  2737. </td>
  2738. </tr>
  2739. <tr>
  2740. <td class='col-2 strong'>opts.plugin</td>
  2741. <td class="col-2 quiet">
  2742. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  2743. </td>
  2744. <td class='col-8'>Plugin name that created this warning.
  2745. PostCSS will set it automatically.
  2746. </td>
  2747. </tr>
  2748. <tr>
  2749. <td class='col-2 strong'>opts.word</td>
  2750. <td class="col-2 quiet">
  2751. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  2752. </td>
  2753. <td class='col-8'>A word inside a node’s string that should
  2754. be highlighted as the source of the warning.
  2755. </td>
  2756. </tr>
  2757. <tr>
  2758. <td class='col-2 strong'>opts.index</td>
  2759. <td class="col-2 quiet">
  2760. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  2761. </td>
  2762. <td class='col-8'>An index inside a node’s string that should
  2763. be highlighted as the source of the warning.
  2764. </td>
  2765. </tr>
  2766. </table>
  2767. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2768. <code><a href="#warning">Warning</a></code>
  2769. :
  2770. <span class='force-inline'>Created warning object.
  2771. </span>
  2772. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2773. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> plugin = postcss.plugin(<span class="hljs-string">'postcss-deprecated'</span>, () =&gt; {
  2774. <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">root, result</span>) =&gt;</span> {
  2775. root.walkDecls(<span class="hljs-string">'bad'</span>, decl =&gt; {
  2776. decl.warn(result, <span class="hljs-string">'Deprecated property bad'</span>)
  2777. })
  2778. }
  2779. })</code></pre>
  2780. </section>
  2781. </div>
  2782. </section>
  2783. <section id='container'class='mt2 mb2 px3 py1 keyline-top'>
  2784. <div class='right py2'>
  2785. <span class='font-smaller'>
  2786. Extends
  2787. <a href="#node">Node</a>
  2788. </span>
  2789. <span class="px2"></span>
  2790. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L23-L693'>
  2791. <span>lib/container.js</span>
  2792. </a>
  2793. </div>
  2794. <h3 class='regular'>
  2795. <a class='black' href='#container'>
  2796. <code>
  2797. Container
  2798. <span class='gray'>()</span>
  2799. </code>
  2800. </a>
  2801. </h3>
  2802. <p>The <a href="#root">Root</a>, <a href="#atrule">AtRule</a>, and <a href="#rule">Rule</a> container nodes
  2803. inherit some common methods to help work with their children.</p>
  2804. <p>Note that all containers can store any content. If you write a rule inside
  2805. a rule, PostCSS will parse it.</p>
  2806. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  2807. <div class="section-indent">
  2808. <section id='containerafter'class='mt2 mb2 px3 py1 keyline-top'>
  2809. <div class='right py2'>
  2810. <span class="px2"></span>
  2811. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L313-L316'>
  2812. <span>lib/node.js</span>
  2813. </a>
  2814. </div>
  2815. <h3 class='regular'>
  2816. <a class='black' href='#containerafter'>
  2817. <code>
  2818. after
  2819. <span class='gray'>(add)</span>
  2820. </code>
  2821. </a>
  2822. </h3>
  2823. <p>Insert new node after current node to current node’s parent.</p>
  2824. <p>Just alias for <code>node.parent.insertAfter(node, add)</code>.</p>
  2825. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2826. <thead class='fill-light'>
  2827. <th class='col-3 small caps quiet'>parameter</th>
  2828. <th class='col-3 small caps quiet'>type</th>
  2829. <th class='col-6 small caps quiet'>description</th>
  2830. </thead>
  2831. <tr>
  2832. <td class='col-3 strong'><code>add</code></td>
  2833. <td class='col-3 quiet'>
  2834. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  2835. </td>
  2836. <td class='col-6'>New node.
  2837. </td>
  2838. </tr>
  2839. </table>
  2840. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2841. <code><a href="#node">Node</a></code>
  2842. :
  2843. <span class='force-inline'>This node for methods chain.
  2844. </span>
  2845. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2846. <pre class='p1 overflow-auto round fill-light'><code>decl.after(<span class="hljs-string">'color: black'</span>)</code></pre>
  2847. </section>
  2848. <section id='containerappend'class='mt2 mb2 px3 py1 keyline-top'>
  2849. <div class='right py2'>
  2850. <span class="px2"></span>
  2851. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L322-L331'>
  2852. <span>lib/container.js</span>
  2853. </a>
  2854. </div>
  2855. <h3 class='regular'>
  2856. <a class='black' href='#containerappend'>
  2857. <code>
  2858. append
  2859. <span class='gray'>(children)</span>
  2860. </code>
  2861. </a>
  2862. </h3>
  2863. <p>Inserts new nodes to the end of the container.</p>
  2864. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2865. <thead class='fill-light'>
  2866. <th class='col-3 small caps quiet'>parameter</th>
  2867. <th class='col-3 small caps quiet'>type</th>
  2868. <th class='col-6 small caps quiet'>description</th>
  2869. </thead>
  2870. <tr>
  2871. <td class='col-3 strong'><code>children</code></td>
  2872. <td class='col-3 quiet'>
  2873. ...(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  2874. </td>
  2875. <td class='col-6'>New nodes.
  2876. </td>
  2877. </tr>
  2878. </table>
  2879. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2880. <code><a href="#node">Node</a></code>
  2881. :
  2882. <span class='force-inline'>This node for methods chain.
  2883. </span>
  2884. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2885. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> decl1 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  2886. <span class="hljs-keyword">const</span> decl2 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'background-color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'white'</span> })
  2887. rule.append(decl1, decl2)
  2888. root.append({ <span class="hljs-attr">name</span>: <span class="hljs-string">'charset'</span>, <span class="hljs-attr">params</span>: <span class="hljs-string">'"UTF-8"'</span> }) <span class="hljs-comment">// at-rule</span>
  2889. root.append({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }) <span class="hljs-comment">// rule</span>
  2890. rule.append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> }) <span class="hljs-comment">// declaration</span>
  2891. rule.append({ <span class="hljs-attr">text</span>: <span class="hljs-string">'Comment'</span> }) <span class="hljs-comment">// comment</span>
  2892. root.append(<span class="hljs-string">'a {}'</span>)
  2893. root.first.append(<span class="hljs-string">'color: black; z-index: 1'</span>)</code></pre>
  2894. </section>
  2895. <section id='containerbefore'class='mt2 mb2 px3 py1 keyline-top'>
  2896. <div class='right py2'>
  2897. <span class="px2"></span>
  2898. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L296-L299'>
  2899. <span>lib/node.js</span>
  2900. </a>
  2901. </div>
  2902. <h3 class='regular'>
  2903. <a class='black' href='#containerbefore'>
  2904. <code>
  2905. before
  2906. <span class='gray'>(add)</span>
  2907. </code>
  2908. </a>
  2909. </h3>
  2910. <p>Insert new node before current node to current node’s parent.</p>
  2911. <p>Just alias for <code>node.parent.insertBefore(node, add)</code>.</p>
  2912. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2913. <thead class='fill-light'>
  2914. <th class='col-3 small caps quiet'>parameter</th>
  2915. <th class='col-3 small caps quiet'>type</th>
  2916. <th class='col-6 small caps quiet'>description</th>
  2917. </thead>
  2918. <tr>
  2919. <td class='col-3 strong'><code>add</code></td>
  2920. <td class='col-3 quiet'>
  2921. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  2922. </td>
  2923. <td class='col-6'>New node.
  2924. </td>
  2925. </tr>
  2926. </table>
  2927. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2928. <code><a href="#node">Node</a></code>
  2929. :
  2930. <span class='force-inline'>This node for methods chain.
  2931. </span>
  2932. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2933. <pre class='p1 overflow-auto round fill-light'><code>decl.before(<span class="hljs-string">'content: ""'</span>)</code></pre>
  2934. </section>
  2935. <section id='containercleanraws'class='mt2 mb2 px3 py1 keyline-top'>
  2936. <div class='right py2'>
  2937. <span class="px2"></span>
  2938. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L394-L398'>
  2939. <span>lib/node.js</span>
  2940. </a>
  2941. </div>
  2942. <h3 class='regular'>
  2943. <a class='black' href='#containercleanraws'>
  2944. <code>
  2945. cleanRaws
  2946. <span class='gray'>(keepBetween?)</span>
  2947. </code>
  2948. </a>
  2949. </h3>
  2950. <p>Clear the code style properties for the node and its children.</p>
  2951. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2952. <thead class='fill-light'>
  2953. <th class='col-3 small caps quiet'>parameter</th>
  2954. <th class='col-3 small caps quiet'>type</th>
  2955. <th class='col-6 small caps quiet'>description</th>
  2956. </thead>
  2957. <tr>
  2958. <td class='col-3 strong'><code>keepBetween</code></td>
  2959. <td class='col-3 quiet'>
  2960. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>?
  2961. </td>
  2962. <td class='col-6'>Keep the raws.between symbols.
  2963. </td>
  2964. </tr>
  2965. </table>
  2966. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  2967. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a></code>
  2968. :
  2969. <span class='force-inline'>
  2970. </span>
  2971. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  2972. <pre class='p1 overflow-auto round fill-light'><code>node.raws.before <span class="hljs-comment">//=&gt; ' '</span>
  2973. node.cleanRaws()
  2974. node.raws.before <span class="hljs-comment">//=&gt; undefined</span></code></pre>
  2975. </section>
  2976. <section id='containerclone'class='mt2 mb2 px3 py1 keyline-top'>
  2977. <div class='right py2'>
  2978. <span class="px2"></span>
  2979. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L183-L189'>
  2980. <span>lib/node.js</span>
  2981. </a>
  2982. </div>
  2983. <h3 class='regular'>
  2984. <a class='black' href='#containerclone'>
  2985. <code>
  2986. clone
  2987. <span class='gray'>(overrides = {})</span>
  2988. </code>
  2989. </a>
  2990. </h3>
  2991. <p>Returns an exact clone of the node.</p>
  2992. <p>The resulting cloned node and its (cloned) children will retain
  2993. code style properties.</p>
  2994. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  2995. <thead class='fill-light'>
  2996. <th class='col-3 small caps quiet'>parameter</th>
  2997. <th class='col-3 small caps quiet'>type</th>
  2998. <th class='col-6 small caps quiet'>description</th>
  2999. </thead>
  3000. <tr>
  3001. <td class='col-3 strong'><code>overrides</code></td>
  3002. <td class='col-3 quiet'>
  3003. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  3004. = <code>{}</code>
  3005. </td>
  3006. <td class='col-6'>New properties to override in the clone.
  3007. </td>
  3008. </tr>
  3009. </table>
  3010. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3011. <code><a href="#node">Node</a></code>
  3012. :
  3013. <span class='force-inline'>Clone of the node.
  3014. </span>
  3015. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3016. <pre class='p1 overflow-auto round fill-light'><code>decl.raws.before <span class="hljs-comment">//=&gt; "\n "</span>
  3017. <span class="hljs-keyword">const</span> cloned = decl.clone({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-moz-'</span> + decl.prop })
  3018. cloned.raws.before <span class="hljs-comment">//=&gt; "\n "</span>
  3019. cloned.toString() <span class="hljs-comment">//=&gt; -moz-transform: scale(0)</span></code></pre>
  3020. </section>
  3021. <section id='containercloneafter'class='mt2 mb2 px3 py1 keyline-top'>
  3022. <div class='right py2'>
  3023. <span class="px2"></span>
  3024. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L216-L220'>
  3025. <span>lib/node.js</span>
  3026. </a>
  3027. </div>
  3028. <h3 class='regular'>
  3029. <a class='black' href='#containercloneafter'>
  3030. <code>
  3031. cloneAfter
  3032. <span class='gray'>(overrides = {})</span>
  3033. </code>
  3034. </a>
  3035. </h3>
  3036. <p>Shortcut to clone the node and insert the resulting cloned node
  3037. after the current node.</p>
  3038. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3039. <thead class='fill-light'>
  3040. <th class='col-3 small caps quiet'>parameter</th>
  3041. <th class='col-3 small caps quiet'>type</th>
  3042. <th class='col-6 small caps quiet'>description</th>
  3043. </thead>
  3044. <tr>
  3045. <td class='col-3 strong'><code>overrides</code></td>
  3046. <td class='col-3 quiet'>
  3047. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  3048. = <code>{}</code>
  3049. </td>
  3050. <td class='col-6'>New properties to override in the clone.
  3051. </td>
  3052. </tr>
  3053. </table>
  3054. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3055. <code><a href="#node">Node</a></code>
  3056. :
  3057. <span class='force-inline'>New node.
  3058. </span>
  3059. </section>
  3060. <section id='containerclonebefore'class='mt2 mb2 px3 py1 keyline-top'>
  3061. <div class='right py2'>
  3062. <span class="px2"></span>
  3063. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L202-L206'>
  3064. <span>lib/node.js</span>
  3065. </a>
  3066. </div>
  3067. <h3 class='regular'>
  3068. <a class='black' href='#containerclonebefore'>
  3069. <code>
  3070. cloneBefore
  3071. <span class='gray'>(overrides = {})</span>
  3072. </code>
  3073. </a>
  3074. </h3>
  3075. <p>Shortcut to clone the node and insert the resulting cloned node
  3076. before the current node.</p>
  3077. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3078. <thead class='fill-light'>
  3079. <th class='col-3 small caps quiet'>parameter</th>
  3080. <th class='col-3 small caps quiet'>type</th>
  3081. <th class='col-6 small caps quiet'>description</th>
  3082. </thead>
  3083. <tr>
  3084. <td class='col-3 strong'><code>overrides</code></td>
  3085. <td class='col-3 quiet'>
  3086. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  3087. = <code>{}</code>
  3088. </td>
  3089. <td class='col-6'>Mew properties to override in the clone.
  3090. </td>
  3091. </tr>
  3092. </table>
  3093. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3094. <code><a href="#node">Node</a></code>
  3095. :
  3096. <span class='force-inline'>New node
  3097. </span>
  3098. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3099. <pre class='p1 overflow-auto round fill-light'><code>decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-moz-'</span> + decl.prop })</code></pre>
  3100. </section>
  3101. <section id='containereach'class='mt2 mb2 px3 py1 keyline-top'>
  3102. <div class='right py2'>
  3103. <span class="px2"></span>
  3104. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L63-L89'>
  3105. <span>lib/container.js</span>
  3106. </a>
  3107. </div>
  3108. <h3 class='regular'>
  3109. <a class='black' href='#containereach'>
  3110. <code>
  3111. each
  3112. <span class='gray'>(callback)</span>
  3113. </code>
  3114. </a>
  3115. </h3>
  3116. <p>Iterates through the container’s immediate children,
  3117. calling <code>callback</code> for each child.</p>
  3118. <p>Returning <code>false</code> in the callback will break iteration.</p>
  3119. <p>This method only iterates through the container’s immediate children.
  3120. If you need to recursively iterate through all the container’s descendant
  3121. nodes, use <a href="#containerwalk">Container#walk</a>.</p>
  3122. <p>Unlike the for <code>{}</code>-cycle or <code>Array#forEach</code> this iterator is safe
  3123. if you are mutating the array of child nodes during iteration.
  3124. PostCSS will adjust the current index to match the mutations.</p>
  3125. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3126. <thead class='fill-light'>
  3127. <th class='col-3 small caps quiet'>parameter</th>
  3128. <th class='col-3 small caps quiet'>type</th>
  3129. <th class='col-6 small caps quiet'>description</th>
  3130. </thead>
  3131. <tr>
  3132. <td class='col-3 strong'><code>callback</code></td>
  3133. <td class='col-3 quiet'>
  3134. <a href="#childiterator">childIterator</a>
  3135. </td>
  3136. <td class='col-6'>Iterator receives each node and index.
  3137. </td>
  3138. </tr>
  3139. </table>
  3140. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3141. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  3142. :
  3143. <span class='force-inline'>Returns
  3144. <code>false</code>
  3145. if iteration was broke.
  3146. </span>
  3147. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3148. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a { color: black; z-index: 1 }'</span>)
  3149. <span class="hljs-keyword">const</span> rule = root.first
  3150. <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> decl <span class="hljs-keyword">of</span> rule.nodes) {
  3151. decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop })
  3152. <span class="hljs-comment">// Cycle will be infinite, because cloneBefore moves the current node</span>
  3153. <span class="hljs-comment">// to the next index</span>
  3154. }
  3155. rule.each(<span class="hljs-function"><span class="hljs-params">decl</span> =&gt;</span> {
  3156. decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop })
  3157. <span class="hljs-comment">// Will be executed only for color and z-index</span>
  3158. })</code></pre>
  3159. </section>
  3160. <section id='containererror'class='mt2 mb2 px3 py1 keyline-top'>
  3161. <div class='right py2'>
  3162. <span class="px2"></span>
  3163. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L89-L95'>
  3164. <span>lib/node.js</span>
  3165. </a>
  3166. </div>
  3167. <h3 class='regular'>
  3168. <a class='black' href='#containererror'>
  3169. <code>
  3170. error
  3171. <span class='gray'>(message, opts = {})</span>
  3172. </code>
  3173. </a>
  3174. </h3>
  3175. <p>Returns a <code>CssSyntaxError</code> instance containing the original position
  3176. of the node in the source, showing line and column numbers and also
  3177. a small excerpt to facilitate debugging.</p>
  3178. <p>If present, an input source map will be used to get the original position
  3179. of the source, even from a previous compilation step
  3180. (e.g., from Sass compilation).</p>
  3181. <p>This method produces very useful error messages.</p>
  3182. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3183. <thead class='fill-light'>
  3184. <th class='col-3 small caps quiet'>parameter</th>
  3185. <th class='col-3 small caps quiet'>type</th>
  3186. <th class='col-6 small caps quiet'>description</th>
  3187. </thead>
  3188. <tr>
  3189. <td class='col-3 strong'><code>message</code></td>
  3190. <td class='col-3 quiet'>
  3191. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  3192. </td>
  3193. <td class='col-6'>Error description.
  3194. </td>
  3195. </tr>
  3196. <tr>
  3197. <td class='col-3 strong'><code>opts</code></td>
  3198. <td class='col-3 quiet'>
  3199. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  3200. = <code>{}</code>
  3201. </td>
  3202. <td class='col-6'>Options.
  3203. </td>
  3204. </tr>
  3205. <tr>
  3206. <td class='col-2 strong'>opts.plugin</td>
  3207. <td class="col-2 quiet">
  3208. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  3209. </td>
  3210. <td class='col-8'>Plugin name that created this error.
  3211. PostCSS will set it automatically.
  3212. </td>
  3213. </tr>
  3214. <tr>
  3215. <td class='col-2 strong'>opts.word</td>
  3216. <td class="col-2 quiet">
  3217. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  3218. </td>
  3219. <td class='col-8'>A word inside a node’s string that should
  3220. be highlighted as the source of the error.
  3221. </td>
  3222. </tr>
  3223. <tr>
  3224. <td class='col-2 strong'>opts.index</td>
  3225. <td class="col-2 quiet">
  3226. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  3227. </td>
  3228. <td class='col-8'>An index inside a node’s string that should
  3229. be highlighted as the source of the error.
  3230. </td>
  3231. </tr>
  3232. </table>
  3233. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3234. <code><a href="#csssyntaxerror">CssSyntaxError</a></code>
  3235. :
  3236. <span class='force-inline'>Error object to throw it.
  3237. </span>
  3238. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3239. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (!variables[name]) {
  3240. <span class="hljs-keyword">throw</span> decl.error(<span class="hljs-string">'Unknown variable '</span> + name, { <span class="hljs-attr">word</span>: name })
  3241. <span class="hljs-comment">// CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black</span>
  3242. <span class="hljs-comment">// color: $black</span>
  3243. <span class="hljs-comment">// a</span>
  3244. <span class="hljs-comment">// ^</span>
  3245. <span class="hljs-comment">// background: white</span>
  3246. }</code></pre>
  3247. </section>
  3248. <section id='containerevery'class='mt2 mb2 px3 py1 keyline-top'>
  3249. <div class='right py2'>
  3250. <span class="px2"></span>
  3251. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L539-L541'>
  3252. <span>lib/container.js</span>
  3253. </a>
  3254. </div>
  3255. <h3 class='regular'>
  3256. <a class='black' href='#containerevery'>
  3257. <code>
  3258. every
  3259. <span class='gray'>(condition)</span>
  3260. </code>
  3261. </a>
  3262. </h3>
  3263. <p>Returns <code>true</code> if callback returns <code>true</code>
  3264. for all of the container’s children.</p>
  3265. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3266. <thead class='fill-light'>
  3267. <th class='col-3 small caps quiet'>parameter</th>
  3268. <th class='col-3 small caps quiet'>type</th>
  3269. <th class='col-6 small caps quiet'>description</th>
  3270. </thead>
  3271. <tr>
  3272. <td class='col-3 strong'><code>condition</code></td>
  3273. <td class='col-3 quiet'>
  3274. <a href="#childcondition">childCondition</a>
  3275. </td>
  3276. <td class='col-6'>Iterator returns true or false.
  3277. </td>
  3278. </tr>
  3279. </table>
  3280. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3281. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  3282. :
  3283. <span class='force-inline'>Is every child pass condition.
  3284. </span>
  3285. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3286. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> noPrefixes = rule.every(<span class="hljs-function"><span class="hljs-params">i</span> =&gt;</span> i.prop[<span class="hljs-number">0</span>] !== <span class="hljs-string">'-'</span>)</code></pre>
  3287. </section>
  3288. <section id='containerfirst'class='mt2 mb2 px3 py1 keyline-top'>
  3289. <div class='right py2'>
  3290. <span class="px2"></span>
  3291. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L582-L585'>
  3292. <span>lib/container.js</span>
  3293. </a>
  3294. </div>
  3295. <h3 class='regular'>
  3296. <a class='black' href='#containerfirst'>
  3297. <code>
  3298. first
  3299. <span class='gray'>()</span>
  3300. </code>
  3301. </a>
  3302. </h3>
  3303. <p>The container’s first child.</p>
  3304. <p>
  3305. Type:
  3306. <a href="#node">Node</a>
  3307. </p>
  3308. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3309. <pre class='p1 overflow-auto round fill-light'><code>rule.first === rules.nodes[<span class="hljs-number">0</span>]</code></pre>
  3310. </section>
  3311. <section id='containerindex'class='mt2 mb2 px3 py1 keyline-top'>
  3312. <div class='right py2'>
  3313. <span class="px2"></span>
  3314. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L568-L572'>
  3315. <span>lib/container.js</span>
  3316. </a>
  3317. </div>
  3318. <h3 class='regular'>
  3319. <a class='black' href='#containerindex'>
  3320. <code>
  3321. index
  3322. <span class='gray'>(child)</span>
  3323. </code>
  3324. </a>
  3325. </h3>
  3326. <p>Returns a <code>child</code>’s index within the <a href="Container#nodes">Container#nodes</a> array.</p>
  3327. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3328. <thead class='fill-light'>
  3329. <th class='col-3 small caps quiet'>parameter</th>
  3330. <th class='col-3 small caps quiet'>type</th>
  3331. <th class='col-6 small caps quiet'>description</th>
  3332. </thead>
  3333. <tr>
  3334. <td class='col-3 strong'><code>child</code></td>
  3335. <td class='col-3 quiet'>
  3336. <a href="#node">Node</a>
  3337. </td>
  3338. <td class='col-6'>Child of the current container.
  3339. </td>
  3340. </tr>
  3341. </table>
  3342. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3343. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
  3344. :
  3345. <span class='force-inline'>Child index.
  3346. </span>
  3347. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3348. <pre class='p1 overflow-auto round fill-light'><code>rule.index( rule.nodes[<span class="hljs-number">2</span>] ) <span class="hljs-comment">//=&gt; 2</span></code></pre>
  3349. </section>
  3350. <section id='containerinsertafter'class='mt2 mb2 px3 py1 keyline-top'>
  3351. <div class='right py2'>
  3352. <span class="px2"></span>
  3353. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L414-L431'>
  3354. <span>lib/container.js</span>
  3355. </a>
  3356. </div>
  3357. <h3 class='regular'>
  3358. <a class='black' href='#containerinsertafter'>
  3359. <code>
  3360. insertAfter
  3361. <span class='gray'>(exist, add)</span>
  3362. </code>
  3363. </a>
  3364. </h3>
  3365. <p>Insert new node after old node within the container.</p>
  3366. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3367. <thead class='fill-light'>
  3368. <th class='col-3 small caps quiet'>parameter</th>
  3369. <th class='col-3 small caps quiet'>type</th>
  3370. <th class='col-6 small caps quiet'>description</th>
  3371. </thead>
  3372. <tr>
  3373. <td class='col-3 strong'><code>exist</code></td>
  3374. <td class='col-3 quiet'>
  3375. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  3376. </td>
  3377. <td class='col-6'>Child or child’s index.
  3378. </td>
  3379. </tr>
  3380. <tr>
  3381. <td class='col-3 strong'><code>add</code></td>
  3382. <td class='col-3 quiet'>
  3383. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  3384. </td>
  3385. <td class='col-6'>New node.
  3386. </td>
  3387. </tr>
  3388. </table>
  3389. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3390. <code><a href="#node">Node</a></code>
  3391. :
  3392. <span class='force-inline'>This node for methods chain.
  3393. </span>
  3394. </section>
  3395. <section id='containerinsertbefore'class='mt2 mb2 px3 py1 keyline-top'>
  3396. <div class='right py2'>
  3397. <span class="px2"></span>
  3398. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L386-L404'>
  3399. <span>lib/container.js</span>
  3400. </a>
  3401. </div>
  3402. <h3 class='regular'>
  3403. <a class='black' href='#containerinsertbefore'>
  3404. <code>
  3405. insertBefore
  3406. <span class='gray'>(exist, add)</span>
  3407. </code>
  3408. </a>
  3409. </h3>
  3410. <p>Insert new node before old node within the container.</p>
  3411. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3412. <thead class='fill-light'>
  3413. <th class='col-3 small caps quiet'>parameter</th>
  3414. <th class='col-3 small caps quiet'>type</th>
  3415. <th class='col-6 small caps quiet'>description</th>
  3416. </thead>
  3417. <tr>
  3418. <td class='col-3 strong'><code>exist</code></td>
  3419. <td class='col-3 quiet'>
  3420. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  3421. </td>
  3422. <td class='col-6'>Child or child’s index.
  3423. </td>
  3424. </tr>
  3425. <tr>
  3426. <td class='col-3 strong'><code>add</code></td>
  3427. <td class='col-3 quiet'>
  3428. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  3429. </td>
  3430. <td class='col-6'>New node.
  3431. </td>
  3432. </tr>
  3433. </table>
  3434. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3435. <code><a href="#node">Node</a></code>
  3436. :
  3437. <span class='force-inline'>This node for methods chain.
  3438. </span>
  3439. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3440. <pre class='p1 overflow-auto round fill-light'><code>rule.insertBefore(decl, decl.clone({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop }))</code></pre>
  3441. </section>
  3442. <section id='containerlast'class='mt2 mb2 px3 py1 keyline-top'>
  3443. <div class='right py2'>
  3444. <span class="px2"></span>
  3445. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L595-L598'>
  3446. <span>lib/container.js</span>
  3447. </a>
  3448. </div>
  3449. <h3 class='regular'>
  3450. <a class='black' href='#containerlast'>
  3451. <code>
  3452. last
  3453. <span class='gray'>()</span>
  3454. </code>
  3455. </a>
  3456. </h3>
  3457. <p>The container’s last child.</p>
  3458. <p>
  3459. Type:
  3460. <a href="#node">Node</a>
  3461. </p>
  3462. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3463. <pre class='p1 overflow-auto round fill-light'><code>rule.last === rule.nodes[rule.nodes.length - <span class="hljs-number">1</span>]</code></pre>
  3464. </section>
  3465. <section id='containernext'class='mt2 mb2 px3 py1 keyline-top'>
  3466. <div class='right py2'>
  3467. <span class="px2"></span>
  3468. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L260-L264'>
  3469. <span>lib/node.js</span>
  3470. </a>
  3471. </div>
  3472. <h3 class='regular'>
  3473. <a class='black' href='#containernext'>
  3474. <code>
  3475. next
  3476. <span class='gray'>()</span>
  3477. </code>
  3478. </a>
  3479. </h3>
  3480. <p>Returns the next child of the node’s parent.
  3481. Returns <code>undefined</code> if the current node is the last child.</p>
  3482. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3483. <code>(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  3484. :
  3485. <span class='force-inline'>Next node.
  3486. </span>
  3487. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3488. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (comment.text === <span class="hljs-string">'delete next'</span>) {
  3489. <span class="hljs-keyword">const</span> next = comment.next()
  3490. <span class="hljs-keyword">if</span> (next) {
  3491. next.remove()
  3492. }
  3493. }</code></pre>
  3494. </section>
  3495. <section id='containerprepend'class='mt2 mb2 px3 py1 keyline-top'>
  3496. <div class='right py2'>
  3497. <span class="px2"></span>
  3498. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L353-L366'>
  3499. <span>lib/container.js</span>
  3500. </a>
  3501. </div>
  3502. <h3 class='regular'>
  3503. <a class='black' href='#containerprepend'>
  3504. <code>
  3505. prepend
  3506. <span class='gray'>(children)</span>
  3507. </code>
  3508. </a>
  3509. </h3>
  3510. <p>Inserts new nodes to the start of the container.</p>
  3511. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3512. <thead class='fill-light'>
  3513. <th class='col-3 small caps quiet'>parameter</th>
  3514. <th class='col-3 small caps quiet'>type</th>
  3515. <th class='col-6 small caps quiet'>description</th>
  3516. </thead>
  3517. <tr>
  3518. <td class='col-3 strong'><code>children</code></td>
  3519. <td class='col-3 quiet'>
  3520. ...(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  3521. </td>
  3522. <td class='col-6'>New nodes.
  3523. </td>
  3524. </tr>
  3525. </table>
  3526. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3527. <code><a href="#node">Node</a></code>
  3528. :
  3529. <span class='force-inline'>This node for methods chain.
  3530. </span>
  3531. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3532. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> decl1 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  3533. <span class="hljs-keyword">const</span> decl2 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'background-color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'white'</span> })
  3534. rule.prepend(decl1, decl2)
  3535. root.append({ <span class="hljs-attr">name</span>: <span class="hljs-string">'charset'</span>, <span class="hljs-attr">params</span>: <span class="hljs-string">'"UTF-8"'</span> }) <span class="hljs-comment">// at-rule</span>
  3536. root.append({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }) <span class="hljs-comment">// rule</span>
  3537. rule.append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> }) <span class="hljs-comment">// declaration</span>
  3538. rule.append({ <span class="hljs-attr">text</span>: <span class="hljs-string">'Comment'</span> }) <span class="hljs-comment">// comment</span>
  3539. root.append(<span class="hljs-string">'a {}'</span>)
  3540. root.first.append(<span class="hljs-string">'color: black; z-index: 1'</span>)</code></pre>
  3541. </section>
  3542. <section id='containerprev'class='mt2 mb2 px3 py1 keyline-top'>
  3543. <div class='right py2'>
  3544. <span class="px2"></span>
  3545. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L278-L282'>
  3546. <span>lib/node.js</span>
  3547. </a>
  3548. </div>
  3549. <h3 class='regular'>
  3550. <a class='black' href='#containerprev'>
  3551. <code>
  3552. prev
  3553. <span class='gray'>()</span>
  3554. </code>
  3555. </a>
  3556. </h3>
  3557. <p>Returns the previous child of the node’s parent.
  3558. Returns <code>undefined</code> if the current node is the first child.</p>
  3559. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3560. <code>(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  3561. :
  3562. <span class='force-inline'>Previous node.
  3563. </span>
  3564. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3565. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> annotation = decl.prev()
  3566. <span class="hljs-keyword">if</span> (annotation.type === <span class="hljs-string">'comment'</span>) {
  3567. readAnnotation(annotation.text)
  3568. }</code></pre>
  3569. </section>
  3570. <section id='containerraw'class='mt2 mb2 px3 py1 keyline-top'>
  3571. <div class='right py2'>
  3572. <span class="px2"></span>
  3573. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L363-L366'>
  3574. <span>lib/node.js</span>
  3575. </a>
  3576. </div>
  3577. <h3 class='regular'>
  3578. <a class='black' href='#containerraw'>
  3579. <code>
  3580. raw
  3581. <span class='gray'>(prop, defaultType?)</span>
  3582. </code>
  3583. </a>
  3584. </h3>
  3585. <p>Returns a <a href="Node#raws">Node#raws</a> value. If the node is missing
  3586. the code style property (because the node was manually built or cloned),
  3587. PostCSS will try to autodetect the code style property by looking
  3588. at other nodes in the tree.</p>
  3589. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3590. <thead class='fill-light'>
  3591. <th class='col-3 small caps quiet'>parameter</th>
  3592. <th class='col-3 small caps quiet'>type</th>
  3593. <th class='col-6 small caps quiet'>description</th>
  3594. </thead>
  3595. <tr>
  3596. <td class='col-3 strong'><code>prop</code></td>
  3597. <td class='col-3 quiet'>
  3598. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  3599. </td>
  3600. <td class='col-6'>Name of code style property.
  3601. </td>
  3602. </tr>
  3603. <tr>
  3604. <td class='col-3 strong'><code>defaultType</code></td>
  3605. <td class='col-3 quiet'>
  3606. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>?
  3607. </td>
  3608. <td class='col-6'>Name of default value, it can be missed
  3609. if the value is the same as prop.
  3610. </td>
  3611. </tr>
  3612. </table>
  3613. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3614. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  3615. :
  3616. <span class='force-inline'>Code style value.
  3617. </span>
  3618. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3619. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a { background: white }'</span>)
  3620. root.nodes[<span class="hljs-number">0</span>].append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  3621. root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">1</span>].raws.before <span class="hljs-comment">//=&gt; undefined</span>
  3622. root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">1</span>].raw(<span class="hljs-string">'before'</span>) <span class="hljs-comment">//=&gt; ' '</span></code></pre>
  3623. </section>
  3624. <section id='containerremove'class='mt2 mb2 px3 py1 keyline-top'>
  3625. <div class='right py2'>
  3626. <span class="px2"></span>
  3627. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L139-L145'>
  3628. <span>lib/node.js</span>
  3629. </a>
  3630. </div>
  3631. <h3 class='regular'>
  3632. <a class='black' href='#containerremove'>
  3633. <code>
  3634. remove
  3635. <span class='gray'>()</span>
  3636. </code>
  3637. </a>
  3638. </h3>
  3639. <p>Removes the node from its parent and cleans the parent properties
  3640. from the node and its children.</p>
  3641. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3642. <code><a href="#node">Node</a></code>
  3643. :
  3644. <span class='force-inline'>Node to make calls chain.
  3645. </span>
  3646. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3647. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (decl.prop.match(<span class="hljs-regexp">/^-webkit-/</span>)) {
  3648. decl.remove()
  3649. }</code></pre>
  3650. </section>
  3651. <section id='containerremoveall'class='mt2 mb2 px3 py1 keyline-top'>
  3652. <div class='right py2'>
  3653. <span class="px2"></span>
  3654. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L475-L482'>
  3655. <span>lib/container.js</span>
  3656. </a>
  3657. </div>
  3658. <h3 class='regular'>
  3659. <a class='black' href='#containerremoveall'>
  3660. <code>
  3661. removeAll
  3662. <span class='gray'>()</span>
  3663. </code>
  3664. </a>
  3665. </h3>
  3666. <p>Removes all children from the container
  3667. and cleans their parent properties.</p>
  3668. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3669. <code><a href="#node">Node</a></code>
  3670. :
  3671. <span class='force-inline'>This node for methods chain.
  3672. </span>
  3673. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3674. <pre class='p1 overflow-auto round fill-light'><code>rule.removeAll()
  3675. rule.nodes.length <span class="hljs-comment">//=&gt; 0</span></code></pre>
  3676. </section>
  3677. <section id='containerremovechild'class='mt2 mb2 px3 py1 keyline-top'>
  3678. <div class='right py2'>
  3679. <span class="px2"></span>
  3680. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L447-L463'>
  3681. <span>lib/container.js</span>
  3682. </a>
  3683. </div>
  3684. <h3 class='regular'>
  3685. <a class='black' href='#containerremovechild'>
  3686. <code>
  3687. removeChild
  3688. <span class='gray'>(child)</span>
  3689. </code>
  3690. </a>
  3691. </h3>
  3692. <p>Removes node from the container and cleans the parent properties
  3693. from the node and its children.</p>
  3694. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3695. <thead class='fill-light'>
  3696. <th class='col-3 small caps quiet'>parameter</th>
  3697. <th class='col-3 small caps quiet'>type</th>
  3698. <th class='col-6 small caps quiet'>description</th>
  3699. </thead>
  3700. <tr>
  3701. <td class='col-3 strong'><code>child</code></td>
  3702. <td class='col-3 quiet'>
  3703. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  3704. </td>
  3705. <td class='col-6'>Child or child’s index.
  3706. </td>
  3707. </tr>
  3708. </table>
  3709. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3710. <code><a href="#node">Node</a></code>
  3711. :
  3712. <span class='force-inline'>This node for methods chain
  3713. </span>
  3714. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3715. <pre class='p1 overflow-auto round fill-light'><code>rule.nodes.length <span class="hljs-comment">//=&gt; 5</span>
  3716. rule.removeChild(decl)
  3717. rule.nodes.length <span class="hljs-comment">//=&gt; 4</span>
  3718. decl.parent <span class="hljs-comment">//=&gt; undefined</span></code></pre>
  3719. </section>
  3720. <section id='containerreplacevalues'class='mt2 mb2 px3 py1 keyline-top'>
  3721. <div class='right py2'>
  3722. <span class="px2"></span>
  3723. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L510-L526'>
  3724. <span>lib/container.js</span>
  3725. </a>
  3726. </div>
  3727. <h3 class='regular'>
  3728. <a class='black' href='#containerreplacevalues'>
  3729. <code>
  3730. replaceValues
  3731. <span class='gray'>(pattern, opts, callback)</span>
  3732. </code>
  3733. </a>
  3734. </h3>
  3735. <p>Passes all declaration values within the container that match pattern
  3736. through callback, replacing those values with the returned result
  3737. of callback.</p>
  3738. <p>This method is useful if you are using a custom unit or function
  3739. and need to iterate through all values.</p>
  3740. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3741. <thead class='fill-light'>
  3742. <th class='col-3 small caps quiet'>parameter</th>
  3743. <th class='col-3 small caps quiet'>type</th>
  3744. <th class='col-6 small caps quiet'>description</th>
  3745. </thead>
  3746. <tr>
  3747. <td class='col-3 strong'><code>pattern</code></td>
  3748. <td class='col-3 quiet'>
  3749. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)
  3750. </td>
  3751. <td class='col-6'>Replace pattern.
  3752. </td>
  3753. </tr>
  3754. <tr>
  3755. <td class='col-3 strong'><code>opts</code></td>
  3756. <td class='col-3 quiet'>
  3757. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  3758. </td>
  3759. <td class='col-6'>Options to speed up the search.
  3760. </td>
  3761. </tr>
  3762. <tr>
  3763. <td class='col-2 strong'>opts.props</td>
  3764. <td class="col-2 quiet">
  3765. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>)
  3766. </td>
  3767. <td class='col-8'>An array of property names.
  3768. </td>
  3769. </tr>
  3770. <tr>
  3771. <td class='col-2 strong'>opts.fast</td>
  3772. <td class="col-2 quiet">
  3773. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  3774. </td>
  3775. <td class='col-8'>String that’s used to narrow down
  3776. values and speed up the regexp search.
  3777. </td>
  3778. </tr>
  3779. <tr>
  3780. <td class='col-3 strong'><code>callback</code></td>
  3781. <td class='col-3 quiet'>
  3782. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)
  3783. </td>
  3784. <td class='col-6'>String to replace pattern or callback
  3785. that returns a new value. The callback
  3786. will receive the same arguments
  3787. as those passed to a function parameter
  3788. of
  3789. <code>String#replace</code>
  3790. .
  3791. </td>
  3792. </tr>
  3793. </table>
  3794. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3795. <code><a href="#node">Node</a></code>
  3796. :
  3797. <span class='force-inline'>This node for methods chain.
  3798. </span>
  3799. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3800. <pre class='p1 overflow-auto round fill-light'><code>root.replaceValues(<span class="hljs-regexp">/\d+rem/</span>, { <span class="hljs-attr">fast</span>: <span class="hljs-string">'rem'</span> }, string =&gt; {
  3801. <span class="hljs-keyword">return</span> <span class="hljs-number">15</span> * <span class="hljs-built_in">parseInt</span>(string) + <span class="hljs-string">'px'</span>
  3802. })</code></pre>
  3803. </section>
  3804. <section id='containerreplacewith'class='mt2 mb2 px3 py1 keyline-top'>
  3805. <div class='right py2'>
  3806. <span class="px2"></span>
  3807. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L234-L244'>
  3808. <span>lib/node.js</span>
  3809. </a>
  3810. </div>
  3811. <h3 class='regular'>
  3812. <a class='black' href='#containerreplacewith'>
  3813. <code>
  3814. replaceWith
  3815. <span class='gray'>(nodes)</span>
  3816. </code>
  3817. </a>
  3818. </h3>
  3819. <p>Inserts node(s) before the current node and removes the current node.</p>
  3820. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3821. <thead class='fill-light'>
  3822. <th class='col-3 small caps quiet'>parameter</th>
  3823. <th class='col-3 small caps quiet'>type</th>
  3824. <th class='col-6 small caps quiet'>description</th>
  3825. </thead>
  3826. <tr>
  3827. <td class='col-3 strong'><code>nodes</code></td>
  3828. <td class='col-3 quiet'>
  3829. ...<a href="#node">Node</a>
  3830. </td>
  3831. <td class='col-6'>Mode(s) to replace current one.
  3832. </td>
  3833. </tr>
  3834. </table>
  3835. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3836. <code><a href="#node">Node</a></code>
  3837. :
  3838. <span class='force-inline'>Current node to methods chain.
  3839. </span>
  3840. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3841. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (atrule.name === <span class="hljs-string">'mixin'</span>) {
  3842. atrule.replaceWith(mixinRules[atrule.params])
  3843. }</code></pre>
  3844. </section>
  3845. <section id='containerroot'class='mt2 mb2 px3 py1 keyline-top'>
  3846. <div class='right py2'>
  3847. <span class="px2"></span>
  3848. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L376-L380'>
  3849. <span>lib/node.js</span>
  3850. </a>
  3851. </div>
  3852. <h3 class='regular'>
  3853. <a class='black' href='#containerroot'>
  3854. <code>
  3855. root
  3856. <span class='gray'>()</span>
  3857. </code>
  3858. </a>
  3859. </h3>
  3860. <p>Finds the Root instance of the node’s tree.</p>
  3861. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3862. <code><a href="#root">Root</a></code>
  3863. :
  3864. <span class='force-inline'>Root parent.
  3865. </span>
  3866. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3867. <pre class='p1 overflow-auto round fill-light'><code>root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">0</span>].root() === root</code></pre>
  3868. </section>
  3869. <section id='containersome'class='mt2 mb2 px3 py1 keyline-top'>
  3870. <div class='right py2'>
  3871. <span class="px2"></span>
  3872. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L554-L556'>
  3873. <span>lib/container.js</span>
  3874. </a>
  3875. </div>
  3876. <h3 class='regular'>
  3877. <a class='black' href='#containersome'>
  3878. <code>
  3879. some
  3880. <span class='gray'>(condition)</span>
  3881. </code>
  3882. </a>
  3883. </h3>
  3884. <p>Returns <code>true</code> if callback returns <code>true</code> for (at least) one
  3885. of the container’s children.</p>
  3886. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3887. <thead class='fill-light'>
  3888. <th class='col-3 small caps quiet'>parameter</th>
  3889. <th class='col-3 small caps quiet'>type</th>
  3890. <th class='col-6 small caps quiet'>description</th>
  3891. </thead>
  3892. <tr>
  3893. <td class='col-3 strong'><code>condition</code></td>
  3894. <td class='col-3 quiet'>
  3895. <a href="#childcondition">childCondition</a>
  3896. </td>
  3897. <td class='col-6'>Iterator returns true or false.
  3898. </td>
  3899. </tr>
  3900. </table>
  3901. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3902. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  3903. :
  3904. <span class='force-inline'>Is some child pass condition.
  3905. </span>
  3906. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3907. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> hasPrefix = rule.some(<span class="hljs-function"><span class="hljs-params">i</span> =&gt;</span> i.prop[<span class="hljs-number">0</span>] === <span class="hljs-string">'-'</span>)</code></pre>
  3908. </section>
  3909. <section id='containertostring'class='mt2 mb2 px3 py1 keyline-top'>
  3910. <div class='right py2'>
  3911. <span class="px2"></span>
  3912. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L158-L165'>
  3913. <span>lib/node.js</span>
  3914. </a>
  3915. </div>
  3916. <h3 class='regular'>
  3917. <a class='black' href='#containertostring'>
  3918. <code>
  3919. toString
  3920. <span class='gray'>(stringifier = stringify)</span>
  3921. </code>
  3922. </a>
  3923. </h3>
  3924. <p>Returns a CSS string representing the node.</p>
  3925. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3926. <thead class='fill-light'>
  3927. <th class='col-3 small caps quiet'>parameter</th>
  3928. <th class='col-3 small caps quiet'>type</th>
  3929. <th class='col-6 small caps quiet'>description</th>
  3930. </thead>
  3931. <tr>
  3932. <td class='col-3 strong'><code>stringifier</code></td>
  3933. <td class='col-3 quiet'>
  3934. (<a href="#stringifier">stringifier</a> | <a href="#syntax">syntax</a>)?
  3935. = <code>stringify</code>
  3936. </td>
  3937. <td class='col-6'>A syntax to use
  3938. in string generation.
  3939. </td>
  3940. </tr>
  3941. </table>
  3942. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3943. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  3944. :
  3945. <span class='force-inline'>CSS string of this node.
  3946. </span>
  3947. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3948. <pre class='p1 overflow-auto round fill-light'><code>postcss.rule({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }).toString() <span class="hljs-comment">//=&gt; "a {}"</span></code></pre>
  3949. </section>
  3950. <section id='containerwalk'class='mt2 mb2 px3 py1 keyline-top'>
  3951. <div class='right py2'>
  3952. <span class="px2"></span>
  3953. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L110-L124'>
  3954. <span>lib/container.js</span>
  3955. </a>
  3956. </div>
  3957. <h3 class='regular'>
  3958. <a class='black' href='#containerwalk'>
  3959. <code>
  3960. walk
  3961. <span class='gray'>(callback)</span>
  3962. </code>
  3963. </a>
  3964. </h3>
  3965. <p>Traverses the container’s descendant nodes, calling callback
  3966. for each node.</p>
  3967. <p>Like container.each(), this method is safe to use
  3968. if you are mutating arrays during iteration.</p>
  3969. <p>If you only need to iterate through the container’s immediate children,
  3970. use <a href="#containereach">Container#each</a>.</p>
  3971. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  3972. <thead class='fill-light'>
  3973. <th class='col-3 small caps quiet'>parameter</th>
  3974. <th class='col-3 small caps quiet'>type</th>
  3975. <th class='col-6 small caps quiet'>description</th>
  3976. </thead>
  3977. <tr>
  3978. <td class='col-3 strong'><code>callback</code></td>
  3979. <td class='col-3 quiet'>
  3980. <a href="#childiterator">childIterator</a>
  3981. </td>
  3982. <td class='col-6'>Iterator receives each node and index.
  3983. </td>
  3984. </tr>
  3985. </table>
  3986. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  3987. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  3988. :
  3989. <span class='force-inline'>Returns
  3990. <code>false</code>
  3991. if iteration was broke.
  3992. </span>
  3993. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  3994. <pre class='p1 overflow-auto round fill-light'><code>root.walk(<span class="hljs-function"><span class="hljs-params">node</span> =&gt;</span> {
  3995. <span class="hljs-comment">// Traverses all descendant nodes.</span>
  3996. })</code></pre>
  3997. </section>
  3998. <section id='containerwalkatrules'class='mt2 mb2 px3 py1 keyline-top'>
  3999. <div class='right py2'>
  4000. <span class="px2"></span>
  4001. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L255-L276'>
  4002. <span>lib/container.js</span>
  4003. </a>
  4004. </div>
  4005. <h3 class='regular'>
  4006. <a class='black' href='#containerwalkatrules'>
  4007. <code>
  4008. walkAtRules
  4009. <span class='gray'>(name?, callback)</span>
  4010. </code>
  4011. </a>
  4012. </h3>
  4013. <p>Traverses the container’s descendant nodes, calling callback
  4014. for each at-rule node.</p>
  4015. <p>If you pass a filter, iteration will only happen over at-rules
  4016. that have matching names.</p>
  4017. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  4018. to use if you are mutating arrays during iteration.</p>
  4019. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4020. <thead class='fill-light'>
  4021. <th class='col-3 small caps quiet'>parameter</th>
  4022. <th class='col-3 small caps quiet'>type</th>
  4023. <th class='col-6 small caps quiet'>description</th>
  4024. </thead>
  4025. <tr>
  4026. <td class='col-3 strong'><code>name</code></td>
  4027. <td class='col-3 quiet'>
  4028. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  4029. </td>
  4030. <td class='col-6'>String or regular expression
  4031. to filter at-rules by name.
  4032. </td>
  4033. </tr>
  4034. <tr>
  4035. <td class='col-3 strong'><code>callback</code></td>
  4036. <td class='col-3 quiet'>
  4037. <a href="#childiterator">childIterator</a>
  4038. </td>
  4039. <td class='col-6'>Iterator receives each node and index.
  4040. </td>
  4041. </tr>
  4042. </table>
  4043. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4044. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  4045. :
  4046. <span class='force-inline'>Returns
  4047. <code>false</code>
  4048. if iteration was broke.
  4049. </span>
  4050. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4051. <pre class='p1 overflow-auto round fill-light'><code>root.walkAtRules(<span class="hljs-function"><span class="hljs-params">rule</span> =&gt;</span> {
  4052. <span class="hljs-keyword">if</span> (isOld(rule.name)) rule.remove()
  4053. })
  4054. <span class="hljs-keyword">let</span> first = <span class="hljs-literal">false</span>
  4055. root.walkAtRules(<span class="hljs-string">'charset'</span>, rule =&gt; {
  4056. <span class="hljs-keyword">if</span> (!first) {
  4057. first = <span class="hljs-literal">true</span>
  4058. } <span class="hljs-keyword">else</span> {
  4059. rule.remove()
  4060. }
  4061. })</code></pre>
  4062. </section>
  4063. <section id='containerwalkcomments'class='mt2 mb2 px3 py1 keyline-top'>
  4064. <div class='right py2'>
  4065. <span class="px2"></span>
  4066. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L294-L300'>
  4067. <span>lib/container.js</span>
  4068. </a>
  4069. </div>
  4070. <h3 class='regular'>
  4071. <a class='black' href='#containerwalkcomments'>
  4072. <code>
  4073. walkComments
  4074. <span class='gray'>(callback)</span>
  4075. </code>
  4076. </a>
  4077. </h3>
  4078. <p>Traverses the container’s descendant nodes, calling callback
  4079. for each comment node.</p>
  4080. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  4081. to use if you are mutating arrays during iteration.</p>
  4082. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4083. <thead class='fill-light'>
  4084. <th class='col-3 small caps quiet'>parameter</th>
  4085. <th class='col-3 small caps quiet'>type</th>
  4086. <th class='col-6 small caps quiet'>description</th>
  4087. </thead>
  4088. <tr>
  4089. <td class='col-3 strong'><code>callback</code></td>
  4090. <td class='col-3 quiet'>
  4091. <a href="#childiterator">childIterator</a>
  4092. </td>
  4093. <td class='col-6'>Iterator receives each node and index.
  4094. </td>
  4095. </tr>
  4096. </table>
  4097. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4098. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  4099. :
  4100. <span class='force-inline'>Returns
  4101. <code>false</code>
  4102. if iteration was broke.
  4103. </span>
  4104. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4105. <pre class='p1 overflow-auto round fill-light'><code>root.walkComments(<span class="hljs-function"><span class="hljs-params">comment</span> =&gt;</span> {
  4106. comment.remove()
  4107. })</code></pre>
  4108. </section>
  4109. <section id='containerwalkdecls'class='mt2 mb2 px3 py1 keyline-top'>
  4110. <div class='right py2'>
  4111. <span class="px2"></span>
  4112. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L155-L176'>
  4113. <span>lib/container.js</span>
  4114. </a>
  4115. </div>
  4116. <h3 class='regular'>
  4117. <a class='black' href='#containerwalkdecls'>
  4118. <code>
  4119. walkDecls
  4120. <span class='gray'>(prop?, callback)</span>
  4121. </code>
  4122. </a>
  4123. </h3>
  4124. <p>Traverses the container’s descendant nodes, calling callback
  4125. for each declaration node.</p>
  4126. <p>If you pass a filter, iteration will only happen over declarations
  4127. with matching properties.</p>
  4128. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  4129. to use if you are mutating arrays during iteration.</p>
  4130. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4131. <thead class='fill-light'>
  4132. <th class='col-3 small caps quiet'>parameter</th>
  4133. <th class='col-3 small caps quiet'>type</th>
  4134. <th class='col-6 small caps quiet'>description</th>
  4135. </thead>
  4136. <tr>
  4137. <td class='col-3 strong'><code>prop</code></td>
  4138. <td class='col-3 quiet'>
  4139. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  4140. </td>
  4141. <td class='col-6'>String or regular expression
  4142. to filter declarations by property name.
  4143. </td>
  4144. </tr>
  4145. <tr>
  4146. <td class='col-3 strong'><code>callback</code></td>
  4147. <td class='col-3 quiet'>
  4148. <a href="#childiterator">childIterator</a>
  4149. </td>
  4150. <td class='col-6'>Iterator receives each node and index.
  4151. </td>
  4152. </tr>
  4153. </table>
  4154. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4155. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  4156. :
  4157. <span class='force-inline'>Returns
  4158. <code>false</code>
  4159. if iteration was broke.
  4160. </span>
  4161. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4162. <pre class='p1 overflow-auto round fill-light'><code>root.walkDecls(<span class="hljs-function"><span class="hljs-params">decl</span> =&gt;</span> {
  4163. checkPropertySupport(decl.prop)
  4164. })
  4165. root.walkDecls(<span class="hljs-string">'border-radius'</span>, decl =&gt; {
  4166. decl.remove()
  4167. })
  4168. root.walkDecls(<span class="hljs-regexp">/^background/</span>, decl =&gt; {
  4169. decl.value = takeFirstColorFromGradient(decl.value)
  4170. })</code></pre>
  4171. </section>
  4172. <section id='containerwalkrules'class='mt2 mb2 px3 py1 keyline-top'>
  4173. <div class='right py2'>
  4174. <span class="px2"></span>
  4175. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L201-L223'>
  4176. <span>lib/container.js</span>
  4177. </a>
  4178. </div>
  4179. <h3 class='regular'>
  4180. <a class='black' href='#containerwalkrules'>
  4181. <code>
  4182. walkRules
  4183. <span class='gray'>(selector?, callback)</span>
  4184. </code>
  4185. </a>
  4186. </h3>
  4187. <p>Traverses the container’s descendant nodes, calling callback
  4188. for each rule node.</p>
  4189. <p>If you pass a filter, iteration will only happen over rules
  4190. with matching selectors.</p>
  4191. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  4192. to use if you are mutating arrays during iteration.</p>
  4193. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4194. <thead class='fill-light'>
  4195. <th class='col-3 small caps quiet'>parameter</th>
  4196. <th class='col-3 small caps quiet'>type</th>
  4197. <th class='col-6 small caps quiet'>description</th>
  4198. </thead>
  4199. <tr>
  4200. <td class='col-3 strong'><code>selector</code></td>
  4201. <td class='col-3 quiet'>
  4202. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  4203. </td>
  4204. <td class='col-6'>String or regular expression
  4205. to filter rules by selector.
  4206. </td>
  4207. </tr>
  4208. <tr>
  4209. <td class='col-3 strong'><code>callback</code></td>
  4210. <td class='col-3 quiet'>
  4211. <a href="#childiterator">childIterator</a>
  4212. </td>
  4213. <td class='col-6'>Iterator receives each node and index.
  4214. </td>
  4215. </tr>
  4216. </table>
  4217. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4218. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  4219. :
  4220. <span class='force-inline'>returns
  4221. <code>false</code>
  4222. if iteration was broke.
  4223. </span>
  4224. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4225. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> selectors = []
  4226. root.walkRules(<span class="hljs-function"><span class="hljs-params">rule</span> =&gt;</span> {
  4227. selectors.push(rule.selector)
  4228. })
  4229. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Your CSS uses <span class="hljs-subst">${ selectors.length }</span> selectors`</span>)</code></pre>
  4230. </section>
  4231. <section id='containerwarn'class='mt2 mb2 px3 py1 keyline-top'>
  4232. <div class='right py2'>
  4233. <span class="px2"></span>
  4234. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L122-L126'>
  4235. <span>lib/node.js</span>
  4236. </a>
  4237. </div>
  4238. <h3 class='regular'>
  4239. <a class='black' href='#containerwarn'>
  4240. <code>
  4241. warn
  4242. <span class='gray'>(result, text, opts?)</span>
  4243. </code>
  4244. </a>
  4245. </h3>
  4246. <p>This method is provided as a convenience wrapper for <a href="#resultwarn">Result#warn</a>.</p>
  4247. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4248. <thead class='fill-light'>
  4249. <th class='col-3 small caps quiet'>parameter</th>
  4250. <th class='col-3 small caps quiet'>type</th>
  4251. <th class='col-6 small caps quiet'>description</th>
  4252. </thead>
  4253. <tr>
  4254. <td class='col-3 strong'><code>result</code></td>
  4255. <td class='col-3 quiet'>
  4256. <a href="#result">Result</a>
  4257. </td>
  4258. <td class='col-6'>The
  4259. <a href="#result">Result</a>
  4260. instance
  4261. that will receive the warning.
  4262. </td>
  4263. </tr>
  4264. <tr>
  4265. <td class='col-3 strong'><code>text</code></td>
  4266. <td class='col-3 quiet'>
  4267. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4268. </td>
  4269. <td class='col-6'>Warning message.
  4270. </td>
  4271. </tr>
  4272. <tr>
  4273. <td class='col-3 strong'><code>opts</code></td>
  4274. <td class='col-3 quiet'>
  4275. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  4276. </td>
  4277. <td class='col-6'>Options
  4278. </td>
  4279. </tr>
  4280. <tr>
  4281. <td class='col-2 strong'>opts.plugin</td>
  4282. <td class="col-2 quiet">
  4283. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4284. </td>
  4285. <td class='col-8'>Plugin name that created this warning.
  4286. PostCSS will set it automatically.
  4287. </td>
  4288. </tr>
  4289. <tr>
  4290. <td class='col-2 strong'>opts.word</td>
  4291. <td class="col-2 quiet">
  4292. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4293. </td>
  4294. <td class='col-8'>A word inside a node’s string that should
  4295. be highlighted as the source of the warning.
  4296. </td>
  4297. </tr>
  4298. <tr>
  4299. <td class='col-2 strong'>opts.index</td>
  4300. <td class="col-2 quiet">
  4301. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  4302. </td>
  4303. <td class='col-8'>An index inside a node’s string that should
  4304. be highlighted as the source of the warning.
  4305. </td>
  4306. </tr>
  4307. </table>
  4308. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4309. <code><a href="#warning">Warning</a></code>
  4310. :
  4311. <span class='force-inline'>Created warning object.
  4312. </span>
  4313. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4314. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> plugin = postcss.plugin(<span class="hljs-string">'postcss-deprecated'</span>, () =&gt; {
  4315. <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">root, result</span>) =&gt;</span> {
  4316. root.walkDecls(<span class="hljs-string">'bad'</span>, decl =&gt; {
  4317. decl.warn(result, <span class="hljs-string">'Deprecated property bad'</span>)
  4318. })
  4319. }
  4320. })</code></pre>
  4321. </section>
  4322. </div>
  4323. </section>
  4324. <section id='csssyntaxerror'class='mt2 mb2 px3 py1 keyline-top'>
  4325. <div class='right py2'>
  4326. <span class='font-smaller'>
  4327. Extends
  4328. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>
  4329. </span>
  4330. <span class="px2"></span>
  4331. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L33-L243'>
  4332. <span>lib/css-syntax-error.js</span>
  4333. </a>
  4334. </div>
  4335. <h3 class='regular'>
  4336. <a class='black' href='#csssyntaxerror'>
  4337. <code>
  4338. CssSyntaxError
  4339. <span class='gray'>(message, line?, column?, source?, file?, plugin?)</span>
  4340. </code>
  4341. </a>
  4342. </h3>
  4343. <p>The CSS parser throws this error for broken CSS.</p>
  4344. <p>Custom parsers can throw this error for broken custom syntax using
  4345. the <a href="#nodeerror">Node#error</a> method.</p>
  4346. <p>PostCSS will use the input source map to detect the original error location.
  4347. If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS,
  4348. PostCSS will show the original position in the Sass file.</p>
  4349. <p>If you need the position in the PostCSS input
  4350. (e.g., to debug the previous compiler), use <code>error.input.file</code>.</p>
  4351. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4352. <thead class='fill-light'>
  4353. <th class='col-3 small caps quiet'>parameter</th>
  4354. <th class='col-3 small caps quiet'>type</th>
  4355. <th class='col-6 small caps quiet'>description</th>
  4356. </thead>
  4357. <tr>
  4358. <td class='col-3 strong'><code>message</code></td>
  4359. <td class='col-3 quiet'>
  4360. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4361. </td>
  4362. <td class='col-6'>Error message.
  4363. </td>
  4364. </tr>
  4365. <tr>
  4366. <td class='col-3 strong'><code>line</code></td>
  4367. <td class='col-3 quiet'>
  4368. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>?
  4369. </td>
  4370. <td class='col-6'>Source line of the error.
  4371. </td>
  4372. </tr>
  4373. <tr>
  4374. <td class='col-3 strong'><code>column</code></td>
  4375. <td class='col-3 quiet'>
  4376. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>?
  4377. </td>
  4378. <td class='col-6'>Source column of the error.
  4379. </td>
  4380. </tr>
  4381. <tr>
  4382. <td class='col-3 strong'><code>source</code></td>
  4383. <td class='col-3 quiet'>
  4384. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>?
  4385. </td>
  4386. <td class='col-6'>Source code of the broken file.
  4387. </td>
  4388. </tr>
  4389. <tr>
  4390. <td class='col-3 strong'><code>file</code></td>
  4391. <td class='col-3 quiet'>
  4392. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>?
  4393. </td>
  4394. <td class='col-6'>Absolute path to the broken file.
  4395. </td>
  4396. </tr>
  4397. <tr>
  4398. <td class='col-3 strong'><code>plugin</code></td>
  4399. <td class='col-3 quiet'>
  4400. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>?
  4401. </td>
  4402. <td class='col-6'>PostCSS plugin name, if error came from plugin.
  4403. </td>
  4404. </tr>
  4405. </table>
  4406. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4407. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-comment">// Catching and checking syntax error</span>
  4408. <span class="hljs-keyword">try</span> {
  4409. postcss.parse(<span class="hljs-string">'a{'</span>)
  4410. } <span class="hljs-keyword">catch</span> (error) {
  4411. <span class="hljs-keyword">if</span> (error.name === <span class="hljs-string">'CssSyntaxError'</span>) {
  4412. error <span class="hljs-comment">//=&gt; CssSyntaxError</span>
  4413. }
  4414. }</code></pre>
  4415. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-comment">// Raising error from plugin</span>
  4416. <span class="hljs-keyword">throw</span> node.error(<span class="hljs-string">'Unknown variable'</span>, { <span class="hljs-attr">plugin</span>: <span class="hljs-string">'postcss-vars'</span> })</code></pre>
  4417. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  4418. <div class="section-indent">
  4419. <section id='csssyntaxerrorname'class='mt2 mb2 px3 py1 keyline-top'>
  4420. <div class='right py2'>
  4421. <span class="px2"></span>
  4422. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L58-L58'>
  4423. <span>lib/css-syntax-error.js</span>
  4424. </a>
  4425. </div>
  4426. <h3 class='regular'>
  4427. <a class='black' href='#csssyntaxerrorname'>
  4428. <code>
  4429. name
  4430. <span class='gray'>()</span>
  4431. </code>
  4432. </a>
  4433. </h3>
  4434. <p>Always equal to <code>'CssSyntaxError'</code>. You should always check error type
  4435. by <code>error.name === 'CssSyntaxError'</code>
  4436. instead of <code>error instanceof CssSyntaxError</code>,
  4437. because npm could have several PostCSS versions.</p>
  4438. <p>
  4439. Type:
  4440. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4441. </p>
  4442. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4443. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (error.name === <span class="hljs-string">'CssSyntaxError'</span>) {
  4444. error <span class="hljs-comment">//=&gt; CssSyntaxError</span>
  4445. }</code></pre>
  4446. </section>
  4447. <section id='csssyntaxerrorreason'class='mt2 mb2 px3 py1 keyline-top'>
  4448. <div class='right py2'>
  4449. <span class="px2"></span>
  4450. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L67-L67'>
  4451. <span>lib/css-syntax-error.js</span>
  4452. </a>
  4453. </div>
  4454. <h3 class='regular'>
  4455. <a class='black' href='#csssyntaxerrorreason'>
  4456. <code>
  4457. reason
  4458. <span class='gray'>()</span>
  4459. </code>
  4460. </a>
  4461. </h3>
  4462. <p>Error message.</p>
  4463. <p>
  4464. Type:
  4465. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4466. </p>
  4467. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4468. <pre class='p1 overflow-auto round fill-light'><code>error.message <span class="hljs-comment">//=&gt; 'Unclosed block'</span></code></pre>
  4469. </section>
  4470. <section id='csssyntaxerrorfile'class='mt2 mb2 px3 py1 keyline-top'>
  4471. <div class='right py2'>
  4472. <span class="px2"></span>
  4473. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L79-L79'>
  4474. <span>lib/css-syntax-error.js</span>
  4475. </a>
  4476. </div>
  4477. <h3 class='regular'>
  4478. <a class='black' href='#csssyntaxerrorfile'>
  4479. <code>
  4480. file
  4481. <span class='gray'>()</span>
  4482. </code>
  4483. </a>
  4484. </h3>
  4485. <p>Absolute path to the broken file.</p>
  4486. <p>
  4487. Type:
  4488. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4489. </p>
  4490. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4491. <pre class='p1 overflow-auto round fill-light'><code>error.file <span class="hljs-comment">//=&gt; 'a.sass'</span>
  4492. error.input.file <span class="hljs-comment">//=&gt; 'a.css'</span></code></pre>
  4493. </section>
  4494. <section id='csssyntaxerrorsource'class='mt2 mb2 px3 py1 keyline-top'>
  4495. <div class='right py2'>
  4496. <span class="px2"></span>
  4497. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L91-L91'>
  4498. <span>lib/css-syntax-error.js</span>
  4499. </a>
  4500. </div>
  4501. <h3 class='regular'>
  4502. <a class='black' href='#csssyntaxerrorsource'>
  4503. <code>
  4504. source
  4505. <span class='gray'>()</span>
  4506. </code>
  4507. </a>
  4508. </h3>
  4509. <p>Source code of the broken file.</p>
  4510. <p>
  4511. Type:
  4512. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4513. </p>
  4514. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4515. <pre class='p1 overflow-auto round fill-light'><code>error.source <span class="hljs-comment">//=&gt; 'a { b {} }'</span>
  4516. error.input.column <span class="hljs-comment">//=&gt; 'a b { }'</span></code></pre>
  4517. </section>
  4518. <section id='csssyntaxerrorplugin'class='mt2 mb2 px3 py1 keyline-top'>
  4519. <div class='right py2'>
  4520. <span class="px2"></span>
  4521. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L102-L102'>
  4522. <span>lib/css-syntax-error.js</span>
  4523. </a>
  4524. </div>
  4525. <h3 class='regular'>
  4526. <a class='black' href='#csssyntaxerrorplugin'>
  4527. <code>
  4528. plugin
  4529. <span class='gray'>()</span>
  4530. </code>
  4531. </a>
  4532. </h3>
  4533. <p>Plugin name, if error came from plugin.</p>
  4534. <p>
  4535. Type:
  4536. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4537. </p>
  4538. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4539. <pre class='p1 overflow-auto round fill-light'><code>error.plugin <span class="hljs-comment">//=&gt; 'postcss-vars'</span></code></pre>
  4540. </section>
  4541. <section id='csssyntaxerrorline'class='mt2 mb2 px3 py1 keyline-top'>
  4542. <div class='right py2'>
  4543. <span class="px2"></span>
  4544. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L114-L114'>
  4545. <span>lib/css-syntax-error.js</span>
  4546. </a>
  4547. </div>
  4548. <h3 class='regular'>
  4549. <a class='black' href='#csssyntaxerrorline'>
  4550. <code>
  4551. line
  4552. <span class='gray'>()</span>
  4553. </code>
  4554. </a>
  4555. </h3>
  4556. <p>Source line of the error.</p>
  4557. <p>
  4558. Type:
  4559. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  4560. </p>
  4561. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4562. <pre class='p1 overflow-auto round fill-light'><code>error.line <span class="hljs-comment">//=&gt; 2</span>
  4563. error.input.line <span class="hljs-comment">//=&gt; 4</span></code></pre>
  4564. </section>
  4565. <section id='csssyntaxerrorcolumn'class='mt2 mb2 px3 py1 keyline-top'>
  4566. <div class='right py2'>
  4567. <span class="px2"></span>
  4568. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L124-L124'>
  4569. <span>lib/css-syntax-error.js</span>
  4570. </a>
  4571. </div>
  4572. <h3 class='regular'>
  4573. <a class='black' href='#csssyntaxerrorcolumn'>
  4574. <code>
  4575. column
  4576. <span class='gray'>()</span>
  4577. </code>
  4578. </a>
  4579. </h3>
  4580. <p>Source column of the error.</p>
  4581. <p>
  4582. Type:
  4583. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  4584. </p>
  4585. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4586. <pre class='p1 overflow-auto round fill-light'><code>error.column <span class="hljs-comment">//=&gt; 1</span>
  4587. error.input.column <span class="hljs-comment">//=&gt; 4</span></code></pre>
  4588. </section>
  4589. <section id='csssyntaxerrormessage'class='mt2 mb2 px3 py1 keyline-top'>
  4590. <div class='right py2'>
  4591. <span class="px2"></span>
  4592. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L144-L144'>
  4593. <span>lib/css-syntax-error.js</span>
  4594. </a>
  4595. </div>
  4596. <h3 class='regular'>
  4597. <a class='black' href='#csssyntaxerrormessage'>
  4598. <code>
  4599. message
  4600. <span class='gray'>()</span>
  4601. </code>
  4602. </a>
  4603. </h3>
  4604. <p>Full error text in the GNU error format
  4605. with plugin, file, line and column.</p>
  4606. <p>
  4607. Type:
  4608. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  4609. </p>
  4610. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4611. <pre class='p1 overflow-auto round fill-light'><code>error.message <span class="hljs-comment">//=&gt; 'a.css:1:1: Unclosed block'</span></code></pre>
  4612. </section>
  4613. <section id='csssyntaxerrorshowsourcecode'class='mt2 mb2 px3 py1 keyline-top'>
  4614. <div class='right py2'>
  4615. <span class="px2"></span>
  4616. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L173-L211'>
  4617. <span>lib/css-syntax-error.js</span>
  4618. </a>
  4619. </div>
  4620. <h3 class='regular'>
  4621. <a class='black' href='#csssyntaxerrorshowsourcecode'>
  4622. <code>
  4623. showSourceCode
  4624. <span class='gray'>(color?)</span>
  4625. </code>
  4626. </a>
  4627. </h3>
  4628. <p>Returns a few lines of CSS source that caused the error.</p>
  4629. <p>If the CSS has an input source map without <code>sourceContent</code>,
  4630. this method will return an empty string.</p>
  4631. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4632. <thead class='fill-light'>
  4633. <th class='col-3 small caps quiet'>parameter</th>
  4634. <th class='col-3 small caps quiet'>type</th>
  4635. <th class='col-6 small caps quiet'>description</th>
  4636. </thead>
  4637. <tr>
  4638. <td class='col-3 strong'><code>color</code></td>
  4639. <td class='col-3 quiet'>
  4640. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>?
  4641. </td>
  4642. <td class='col-6'>Whether arrow will be colored red by terminal
  4643. color codes. By default, PostCSS will detect
  4644. color support by
  4645. <code>process.stdout.isTTY</code>
  4646. and
  4647. <code>process.env.NODE_DISABLE_COLORS</code>
  4648. .
  4649. </td>
  4650. </tr>
  4651. </table>
  4652. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4653. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  4654. :
  4655. <span class='force-inline'>Few lines of CSS source that caused the error.
  4656. </span>
  4657. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4658. <pre class='p1 overflow-auto round fill-light'><code>error.showSourceCode() <span class="hljs-comment">//=&gt; " 4 | }</span>
  4659. <span class="hljs-comment">// 5 | a {</span>
  4660. <span class="hljs-comment">// &gt; 6 | bad</span>
  4661. <span class="hljs-comment">// | ^</span>
  4662. <span class="hljs-comment">// 7 | }</span>
  4663. <span class="hljs-comment">// 8 | b {"</span></code></pre>
  4664. </section>
  4665. <section id='csssyntaxerrortostring'class='mt2 mb2 px3 py1 keyline-top'>
  4666. <div class='right py2'>
  4667. <span class="px2"></span>
  4668. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/css-syntax-error.js#L223-L229'>
  4669. <span>lib/css-syntax-error.js</span>
  4670. </a>
  4671. </div>
  4672. <h3 class='regular'>
  4673. <a class='black' href='#csssyntaxerrortostring'>
  4674. <code>
  4675. toString
  4676. <span class='gray'>()</span>
  4677. </code>
  4678. </a>
  4679. </h3>
  4680. <p>Returns error position, message and source code of the broken part.</p>
  4681. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4682. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  4683. :
  4684. <span class='force-inline'>Error position, message and source code.
  4685. </span>
  4686. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4687. <pre class='p1 overflow-auto round fill-light'><code>error.toString() <span class="hljs-comment">//=&gt; "CssSyntaxError: app.css:1:1: Unclosed block</span>
  4688. <span class="hljs-comment">// &gt; 1 | a {</span>
  4689. <span class="hljs-comment">// | ^"</span></code></pre>
  4690. </section>
  4691. </div>
  4692. </section>
  4693. <section id='declaration'class='mt2 mb2 px3 py1 keyline-top'>
  4694. <div class='right py2'>
  4695. <span class='font-smaller'>
  4696. Extends
  4697. <a href="#node">Node</a>
  4698. </span>
  4699. <span class="px2"></span>
  4700. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/declaration.js#L14-L75'>
  4701. <span>lib/declaration.js</span>
  4702. </a>
  4703. </div>
  4704. <h3 class='regular'>
  4705. <a class='black' href='#declaration'>
  4706. <code>
  4707. Declaration
  4708. <span class='gray'>(defaults)</span>
  4709. </code>
  4710. </a>
  4711. </h3>
  4712. <p>Represents a CSS declaration.</p>
  4713. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4714. <thead class='fill-light'>
  4715. <th class='col-3 small caps quiet'>parameter</th>
  4716. <th class='col-3 small caps quiet'>type</th>
  4717. <th class='col-6 small caps quiet'>description</th>
  4718. </thead>
  4719. <tr>
  4720. <td class='col-3 strong'><code>defaults</code></td>
  4721. <td class='col-3 quiet'>
  4722. any
  4723. </td>
  4724. <td class='col-6'></td>
  4725. </tr>
  4726. </table>
  4727. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4728. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a { color: black }'</span>)
  4729. <span class="hljs-keyword">const</span> decl = root.first.first
  4730. decl.type <span class="hljs-comment">//=&gt; 'decl'</span>
  4731. decl.toString() <span class="hljs-comment">//=&gt; ' color: black'</span></code></pre>
  4732. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  4733. <div class="section-indent">
  4734. <section id='declarationafter'class='mt2 mb2 px3 py1 keyline-top'>
  4735. <div class='right py2'>
  4736. <span class="px2"></span>
  4737. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L313-L316'>
  4738. <span>lib/node.js</span>
  4739. </a>
  4740. </div>
  4741. <h3 class='regular'>
  4742. <a class='black' href='#declarationafter'>
  4743. <code>
  4744. after
  4745. <span class='gray'>(add)</span>
  4746. </code>
  4747. </a>
  4748. </h3>
  4749. <p>Insert new node after current node to current node’s parent.</p>
  4750. <p>Just alias for <code>node.parent.insertAfter(node, add)</code>.</p>
  4751. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4752. <thead class='fill-light'>
  4753. <th class='col-3 small caps quiet'>parameter</th>
  4754. <th class='col-3 small caps quiet'>type</th>
  4755. <th class='col-6 small caps quiet'>description</th>
  4756. </thead>
  4757. <tr>
  4758. <td class='col-3 strong'><code>add</code></td>
  4759. <td class='col-3 quiet'>
  4760. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  4761. </td>
  4762. <td class='col-6'>New node.
  4763. </td>
  4764. </tr>
  4765. </table>
  4766. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4767. <code><a href="#node">Node</a></code>
  4768. :
  4769. <span class='force-inline'>This node for methods chain.
  4770. </span>
  4771. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4772. <pre class='p1 overflow-auto round fill-light'><code>decl.after(<span class="hljs-string">'color: black'</span>)</code></pre>
  4773. </section>
  4774. <section id='declarationbefore'class='mt2 mb2 px3 py1 keyline-top'>
  4775. <div class='right py2'>
  4776. <span class="px2"></span>
  4777. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L296-L299'>
  4778. <span>lib/node.js</span>
  4779. </a>
  4780. </div>
  4781. <h3 class='regular'>
  4782. <a class='black' href='#declarationbefore'>
  4783. <code>
  4784. before
  4785. <span class='gray'>(add)</span>
  4786. </code>
  4787. </a>
  4788. </h3>
  4789. <p>Insert new node before current node to current node’s parent.</p>
  4790. <p>Just alias for <code>node.parent.insertBefore(node, add)</code>.</p>
  4791. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4792. <thead class='fill-light'>
  4793. <th class='col-3 small caps quiet'>parameter</th>
  4794. <th class='col-3 small caps quiet'>type</th>
  4795. <th class='col-6 small caps quiet'>description</th>
  4796. </thead>
  4797. <tr>
  4798. <td class='col-3 strong'><code>add</code></td>
  4799. <td class='col-3 quiet'>
  4800. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  4801. </td>
  4802. <td class='col-6'>New node.
  4803. </td>
  4804. </tr>
  4805. </table>
  4806. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4807. <code><a href="#node">Node</a></code>
  4808. :
  4809. <span class='force-inline'>This node for methods chain.
  4810. </span>
  4811. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4812. <pre class='p1 overflow-auto round fill-light'><code>decl.before(<span class="hljs-string">'content: ""'</span>)</code></pre>
  4813. </section>
  4814. <section id='declarationcleanraws'class='mt2 mb2 px3 py1 keyline-top'>
  4815. <div class='right py2'>
  4816. <span class="px2"></span>
  4817. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L394-L398'>
  4818. <span>lib/node.js</span>
  4819. </a>
  4820. </div>
  4821. <h3 class='regular'>
  4822. <a class='black' href='#declarationcleanraws'>
  4823. <code>
  4824. cleanRaws
  4825. <span class='gray'>(keepBetween?)</span>
  4826. </code>
  4827. </a>
  4828. </h3>
  4829. <p>Clear the code style properties for the node and its children.</p>
  4830. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4831. <thead class='fill-light'>
  4832. <th class='col-3 small caps quiet'>parameter</th>
  4833. <th class='col-3 small caps quiet'>type</th>
  4834. <th class='col-6 small caps quiet'>description</th>
  4835. </thead>
  4836. <tr>
  4837. <td class='col-3 strong'><code>keepBetween</code></td>
  4838. <td class='col-3 quiet'>
  4839. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>?
  4840. </td>
  4841. <td class='col-6'>Keep the raws.between symbols.
  4842. </td>
  4843. </tr>
  4844. </table>
  4845. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4846. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a></code>
  4847. :
  4848. <span class='force-inline'>
  4849. </span>
  4850. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4851. <pre class='p1 overflow-auto round fill-light'><code>node.raws.before <span class="hljs-comment">//=&gt; ' '</span>
  4852. node.cleanRaws()
  4853. node.raws.before <span class="hljs-comment">//=&gt; undefined</span></code></pre>
  4854. </section>
  4855. <section id='declarationclone'class='mt2 mb2 px3 py1 keyline-top'>
  4856. <div class='right py2'>
  4857. <span class="px2"></span>
  4858. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L183-L189'>
  4859. <span>lib/node.js</span>
  4860. </a>
  4861. </div>
  4862. <h3 class='regular'>
  4863. <a class='black' href='#declarationclone'>
  4864. <code>
  4865. clone
  4866. <span class='gray'>(overrides = {})</span>
  4867. </code>
  4868. </a>
  4869. </h3>
  4870. <p>Returns an exact clone of the node.</p>
  4871. <p>The resulting cloned node and its (cloned) children will retain
  4872. code style properties.</p>
  4873. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4874. <thead class='fill-light'>
  4875. <th class='col-3 small caps quiet'>parameter</th>
  4876. <th class='col-3 small caps quiet'>type</th>
  4877. <th class='col-6 small caps quiet'>description</th>
  4878. </thead>
  4879. <tr>
  4880. <td class='col-3 strong'><code>overrides</code></td>
  4881. <td class='col-3 quiet'>
  4882. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  4883. = <code>{}</code>
  4884. </td>
  4885. <td class='col-6'>New properties to override in the clone.
  4886. </td>
  4887. </tr>
  4888. </table>
  4889. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4890. <code><a href="#node">Node</a></code>
  4891. :
  4892. <span class='force-inline'>Clone of the node.
  4893. </span>
  4894. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4895. <pre class='p1 overflow-auto round fill-light'><code>decl.raws.before <span class="hljs-comment">//=&gt; "\n "</span>
  4896. <span class="hljs-keyword">const</span> cloned = decl.clone({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-moz-'</span> + decl.prop })
  4897. cloned.raws.before <span class="hljs-comment">//=&gt; "\n "</span>
  4898. cloned.toString() <span class="hljs-comment">//=&gt; -moz-transform: scale(0)</span></code></pre>
  4899. </section>
  4900. <section id='declarationcloneafter'class='mt2 mb2 px3 py1 keyline-top'>
  4901. <div class='right py2'>
  4902. <span class="px2"></span>
  4903. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L216-L220'>
  4904. <span>lib/node.js</span>
  4905. </a>
  4906. </div>
  4907. <h3 class='regular'>
  4908. <a class='black' href='#declarationcloneafter'>
  4909. <code>
  4910. cloneAfter
  4911. <span class='gray'>(overrides = {})</span>
  4912. </code>
  4913. </a>
  4914. </h3>
  4915. <p>Shortcut to clone the node and insert the resulting cloned node
  4916. after the current node.</p>
  4917. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4918. <thead class='fill-light'>
  4919. <th class='col-3 small caps quiet'>parameter</th>
  4920. <th class='col-3 small caps quiet'>type</th>
  4921. <th class='col-6 small caps quiet'>description</th>
  4922. </thead>
  4923. <tr>
  4924. <td class='col-3 strong'><code>overrides</code></td>
  4925. <td class='col-3 quiet'>
  4926. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  4927. = <code>{}</code>
  4928. </td>
  4929. <td class='col-6'>New properties to override in the clone.
  4930. </td>
  4931. </tr>
  4932. </table>
  4933. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4934. <code><a href="#node">Node</a></code>
  4935. :
  4936. <span class='force-inline'>New node.
  4937. </span>
  4938. </section>
  4939. <section id='declarationclonebefore'class='mt2 mb2 px3 py1 keyline-top'>
  4940. <div class='right py2'>
  4941. <span class="px2"></span>
  4942. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L202-L206'>
  4943. <span>lib/node.js</span>
  4944. </a>
  4945. </div>
  4946. <h3 class='regular'>
  4947. <a class='black' href='#declarationclonebefore'>
  4948. <code>
  4949. cloneBefore
  4950. <span class='gray'>(overrides = {})</span>
  4951. </code>
  4952. </a>
  4953. </h3>
  4954. <p>Shortcut to clone the node and insert the resulting cloned node
  4955. before the current node.</p>
  4956. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  4957. <thead class='fill-light'>
  4958. <th class='col-3 small caps quiet'>parameter</th>
  4959. <th class='col-3 small caps quiet'>type</th>
  4960. <th class='col-6 small caps quiet'>description</th>
  4961. </thead>
  4962. <tr>
  4963. <td class='col-3 strong'><code>overrides</code></td>
  4964. <td class='col-3 quiet'>
  4965. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  4966. = <code>{}</code>
  4967. </td>
  4968. <td class='col-6'>Mew properties to override in the clone.
  4969. </td>
  4970. </tr>
  4971. </table>
  4972. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  4973. <code><a href="#node">Node</a></code>
  4974. :
  4975. <span class='force-inline'>New node
  4976. </span>
  4977. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  4978. <pre class='p1 overflow-auto round fill-light'><code>decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-moz-'</span> + decl.prop })</code></pre>
  4979. </section>
  4980. <section id='declarationerror'class='mt2 mb2 px3 py1 keyline-top'>
  4981. <div class='right py2'>
  4982. <span class="px2"></span>
  4983. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L89-L95'>
  4984. <span>lib/node.js</span>
  4985. </a>
  4986. </div>
  4987. <h3 class='regular'>
  4988. <a class='black' href='#declarationerror'>
  4989. <code>
  4990. error
  4991. <span class='gray'>(message, opts = {})</span>
  4992. </code>
  4993. </a>
  4994. </h3>
  4995. <p>Returns a <code>CssSyntaxError</code> instance containing the original position
  4996. of the node in the source, showing line and column numbers and also
  4997. a small excerpt to facilitate debugging.</p>
  4998. <p>If present, an input source map will be used to get the original position
  4999. of the source, even from a previous compilation step
  5000. (e.g., from Sass compilation).</p>
  5001. <p>This method produces very useful error messages.</p>
  5002. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5003. <thead class='fill-light'>
  5004. <th class='col-3 small caps quiet'>parameter</th>
  5005. <th class='col-3 small caps quiet'>type</th>
  5006. <th class='col-6 small caps quiet'>description</th>
  5007. </thead>
  5008. <tr>
  5009. <td class='col-3 strong'><code>message</code></td>
  5010. <td class='col-3 quiet'>
  5011. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5012. </td>
  5013. <td class='col-6'>Error description.
  5014. </td>
  5015. </tr>
  5016. <tr>
  5017. <td class='col-3 strong'><code>opts</code></td>
  5018. <td class='col-3 quiet'>
  5019. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  5020. = <code>{}</code>
  5021. </td>
  5022. <td class='col-6'>Options.
  5023. </td>
  5024. </tr>
  5025. <tr>
  5026. <td class='col-2 strong'>opts.plugin</td>
  5027. <td class="col-2 quiet">
  5028. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5029. </td>
  5030. <td class='col-8'>Plugin name that created this error.
  5031. PostCSS will set it automatically.
  5032. </td>
  5033. </tr>
  5034. <tr>
  5035. <td class='col-2 strong'>opts.word</td>
  5036. <td class="col-2 quiet">
  5037. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5038. </td>
  5039. <td class='col-8'>A word inside a node’s string that should
  5040. be highlighted as the source of the error.
  5041. </td>
  5042. </tr>
  5043. <tr>
  5044. <td class='col-2 strong'>opts.index</td>
  5045. <td class="col-2 quiet">
  5046. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  5047. </td>
  5048. <td class='col-8'>An index inside a node’s string that should
  5049. be highlighted as the source of the error.
  5050. </td>
  5051. </tr>
  5052. </table>
  5053. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5054. <code><a href="#csssyntaxerror">CssSyntaxError</a></code>
  5055. :
  5056. <span class='force-inline'>Error object to throw it.
  5057. </span>
  5058. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5059. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (!variables[name]) {
  5060. <span class="hljs-keyword">throw</span> decl.error(<span class="hljs-string">'Unknown variable '</span> + name, { <span class="hljs-attr">word</span>: name })
  5061. <span class="hljs-comment">// CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black</span>
  5062. <span class="hljs-comment">// color: $black</span>
  5063. <span class="hljs-comment">// a</span>
  5064. <span class="hljs-comment">// ^</span>
  5065. <span class="hljs-comment">// background: white</span>
  5066. }</code></pre>
  5067. </section>
  5068. <section id='declarationnext'class='mt2 mb2 px3 py1 keyline-top'>
  5069. <div class='right py2'>
  5070. <span class="px2"></span>
  5071. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L260-L264'>
  5072. <span>lib/node.js</span>
  5073. </a>
  5074. </div>
  5075. <h3 class='regular'>
  5076. <a class='black' href='#declarationnext'>
  5077. <code>
  5078. next
  5079. <span class='gray'>()</span>
  5080. </code>
  5081. </a>
  5082. </h3>
  5083. <p>Returns the next child of the node’s parent.
  5084. Returns <code>undefined</code> if the current node is the last child.</p>
  5085. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5086. <code>(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  5087. :
  5088. <span class='force-inline'>Next node.
  5089. </span>
  5090. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5091. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (comment.text === <span class="hljs-string">'delete next'</span>) {
  5092. <span class="hljs-keyword">const</span> next = comment.next()
  5093. <span class="hljs-keyword">if</span> (next) {
  5094. next.remove()
  5095. }
  5096. }</code></pre>
  5097. </section>
  5098. <section id='declarationprev'class='mt2 mb2 px3 py1 keyline-top'>
  5099. <div class='right py2'>
  5100. <span class="px2"></span>
  5101. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L278-L282'>
  5102. <span>lib/node.js</span>
  5103. </a>
  5104. </div>
  5105. <h3 class='regular'>
  5106. <a class='black' href='#declarationprev'>
  5107. <code>
  5108. prev
  5109. <span class='gray'>()</span>
  5110. </code>
  5111. </a>
  5112. </h3>
  5113. <p>Returns the previous child of the node’s parent.
  5114. Returns <code>undefined</code> if the current node is the first child.</p>
  5115. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5116. <code>(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  5117. :
  5118. <span class='force-inline'>Previous node.
  5119. </span>
  5120. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5121. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> annotation = decl.prev()
  5122. <span class="hljs-keyword">if</span> (annotation.type === <span class="hljs-string">'comment'</span>) {
  5123. readAnnotation(annotation.text)
  5124. }</code></pre>
  5125. </section>
  5126. <section id='declarationraw'class='mt2 mb2 px3 py1 keyline-top'>
  5127. <div class='right py2'>
  5128. <span class="px2"></span>
  5129. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L363-L366'>
  5130. <span>lib/node.js</span>
  5131. </a>
  5132. </div>
  5133. <h3 class='regular'>
  5134. <a class='black' href='#declarationraw'>
  5135. <code>
  5136. raw
  5137. <span class='gray'>(prop, defaultType?)</span>
  5138. </code>
  5139. </a>
  5140. </h3>
  5141. <p>Returns a <a href="Node#raws">Node#raws</a> value. If the node is missing
  5142. the code style property (because the node was manually built or cloned),
  5143. PostCSS will try to autodetect the code style property by looking
  5144. at other nodes in the tree.</p>
  5145. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5146. <thead class='fill-light'>
  5147. <th class='col-3 small caps quiet'>parameter</th>
  5148. <th class='col-3 small caps quiet'>type</th>
  5149. <th class='col-6 small caps quiet'>description</th>
  5150. </thead>
  5151. <tr>
  5152. <td class='col-3 strong'><code>prop</code></td>
  5153. <td class='col-3 quiet'>
  5154. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5155. </td>
  5156. <td class='col-6'>Name of code style property.
  5157. </td>
  5158. </tr>
  5159. <tr>
  5160. <td class='col-3 strong'><code>defaultType</code></td>
  5161. <td class='col-3 quiet'>
  5162. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>?
  5163. </td>
  5164. <td class='col-6'>Name of default value, it can be missed
  5165. if the value is the same as prop.
  5166. </td>
  5167. </tr>
  5168. </table>
  5169. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5170. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  5171. :
  5172. <span class='force-inline'>Code style value.
  5173. </span>
  5174. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5175. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a { background: white }'</span>)
  5176. root.nodes[<span class="hljs-number">0</span>].append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  5177. root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">1</span>].raws.before <span class="hljs-comment">//=&gt; undefined</span>
  5178. root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">1</span>].raw(<span class="hljs-string">'before'</span>) <span class="hljs-comment">//=&gt; ' '</span></code></pre>
  5179. </section>
  5180. <section id='declarationremove'class='mt2 mb2 px3 py1 keyline-top'>
  5181. <div class='right py2'>
  5182. <span class="px2"></span>
  5183. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L139-L145'>
  5184. <span>lib/node.js</span>
  5185. </a>
  5186. </div>
  5187. <h3 class='regular'>
  5188. <a class='black' href='#declarationremove'>
  5189. <code>
  5190. remove
  5191. <span class='gray'>()</span>
  5192. </code>
  5193. </a>
  5194. </h3>
  5195. <p>Removes the node from its parent and cleans the parent properties
  5196. from the node and its children.</p>
  5197. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5198. <code><a href="#node">Node</a></code>
  5199. :
  5200. <span class='force-inline'>Node to make calls chain.
  5201. </span>
  5202. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5203. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (decl.prop.match(<span class="hljs-regexp">/^-webkit-/</span>)) {
  5204. decl.remove()
  5205. }</code></pre>
  5206. </section>
  5207. <section id='declarationreplacewith'class='mt2 mb2 px3 py1 keyline-top'>
  5208. <div class='right py2'>
  5209. <span class="px2"></span>
  5210. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L234-L244'>
  5211. <span>lib/node.js</span>
  5212. </a>
  5213. </div>
  5214. <h3 class='regular'>
  5215. <a class='black' href='#declarationreplacewith'>
  5216. <code>
  5217. replaceWith
  5218. <span class='gray'>(nodes)</span>
  5219. </code>
  5220. </a>
  5221. </h3>
  5222. <p>Inserts node(s) before the current node and removes the current node.</p>
  5223. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5224. <thead class='fill-light'>
  5225. <th class='col-3 small caps quiet'>parameter</th>
  5226. <th class='col-3 small caps quiet'>type</th>
  5227. <th class='col-6 small caps quiet'>description</th>
  5228. </thead>
  5229. <tr>
  5230. <td class='col-3 strong'><code>nodes</code></td>
  5231. <td class='col-3 quiet'>
  5232. ...<a href="#node">Node</a>
  5233. </td>
  5234. <td class='col-6'>Mode(s) to replace current one.
  5235. </td>
  5236. </tr>
  5237. </table>
  5238. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5239. <code><a href="#node">Node</a></code>
  5240. :
  5241. <span class='force-inline'>Current node to methods chain.
  5242. </span>
  5243. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5244. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (atrule.name === <span class="hljs-string">'mixin'</span>) {
  5245. atrule.replaceWith(mixinRules[atrule.params])
  5246. }</code></pre>
  5247. </section>
  5248. <section id='declarationroot'class='mt2 mb2 px3 py1 keyline-top'>
  5249. <div class='right py2'>
  5250. <span class="px2"></span>
  5251. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L376-L380'>
  5252. <span>lib/node.js</span>
  5253. </a>
  5254. </div>
  5255. <h3 class='regular'>
  5256. <a class='black' href='#declarationroot'>
  5257. <code>
  5258. root
  5259. <span class='gray'>()</span>
  5260. </code>
  5261. </a>
  5262. </h3>
  5263. <p>Finds the Root instance of the node’s tree.</p>
  5264. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5265. <code><a href="#root">Root</a></code>
  5266. :
  5267. <span class='force-inline'>Root parent.
  5268. </span>
  5269. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5270. <pre class='p1 overflow-auto round fill-light'><code>root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">0</span>].root() === root</code></pre>
  5271. </section>
  5272. <section id='declarationtostring'class='mt2 mb2 px3 py1 keyline-top'>
  5273. <div class='right py2'>
  5274. <span class="px2"></span>
  5275. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L158-L165'>
  5276. <span>lib/node.js</span>
  5277. </a>
  5278. </div>
  5279. <h3 class='regular'>
  5280. <a class='black' href='#declarationtostring'>
  5281. <code>
  5282. toString
  5283. <span class='gray'>(stringifier = stringify)</span>
  5284. </code>
  5285. </a>
  5286. </h3>
  5287. <p>Returns a CSS string representing the node.</p>
  5288. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5289. <thead class='fill-light'>
  5290. <th class='col-3 small caps quiet'>parameter</th>
  5291. <th class='col-3 small caps quiet'>type</th>
  5292. <th class='col-6 small caps quiet'>description</th>
  5293. </thead>
  5294. <tr>
  5295. <td class='col-3 strong'><code>stringifier</code></td>
  5296. <td class='col-3 quiet'>
  5297. (<a href="#stringifier">stringifier</a> | <a href="#syntax">syntax</a>)?
  5298. = <code>stringify</code>
  5299. </td>
  5300. <td class='col-6'>A syntax to use
  5301. in string generation.
  5302. </td>
  5303. </tr>
  5304. </table>
  5305. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5306. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  5307. :
  5308. <span class='force-inline'>CSS string of this node.
  5309. </span>
  5310. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5311. <pre class='p1 overflow-auto round fill-light'><code>postcss.rule({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }).toString() <span class="hljs-comment">//=&gt; "a {}"</span></code></pre>
  5312. </section>
  5313. <section id='declarationwarn'class='mt2 mb2 px3 py1 keyline-top'>
  5314. <div class='right py2'>
  5315. <span class="px2"></span>
  5316. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L122-L126'>
  5317. <span>lib/node.js</span>
  5318. </a>
  5319. </div>
  5320. <h3 class='regular'>
  5321. <a class='black' href='#declarationwarn'>
  5322. <code>
  5323. warn
  5324. <span class='gray'>(result, text, opts?)</span>
  5325. </code>
  5326. </a>
  5327. </h3>
  5328. <p>This method is provided as a convenience wrapper for <a href="#resultwarn">Result#warn</a>.</p>
  5329. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5330. <thead class='fill-light'>
  5331. <th class='col-3 small caps quiet'>parameter</th>
  5332. <th class='col-3 small caps quiet'>type</th>
  5333. <th class='col-6 small caps quiet'>description</th>
  5334. </thead>
  5335. <tr>
  5336. <td class='col-3 strong'><code>result</code></td>
  5337. <td class='col-3 quiet'>
  5338. <a href="#result">Result</a>
  5339. </td>
  5340. <td class='col-6'>The
  5341. <a href="#result">Result</a>
  5342. instance
  5343. that will receive the warning.
  5344. </td>
  5345. </tr>
  5346. <tr>
  5347. <td class='col-3 strong'><code>text</code></td>
  5348. <td class='col-3 quiet'>
  5349. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5350. </td>
  5351. <td class='col-6'>Warning message.
  5352. </td>
  5353. </tr>
  5354. <tr>
  5355. <td class='col-3 strong'><code>opts</code></td>
  5356. <td class='col-3 quiet'>
  5357. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  5358. </td>
  5359. <td class='col-6'>Options
  5360. </td>
  5361. </tr>
  5362. <tr>
  5363. <td class='col-2 strong'>opts.plugin</td>
  5364. <td class="col-2 quiet">
  5365. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5366. </td>
  5367. <td class='col-8'>Plugin name that created this warning.
  5368. PostCSS will set it automatically.
  5369. </td>
  5370. </tr>
  5371. <tr>
  5372. <td class='col-2 strong'>opts.word</td>
  5373. <td class="col-2 quiet">
  5374. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5375. </td>
  5376. <td class='col-8'>A word inside a node’s string that should
  5377. be highlighted as the source of the warning.
  5378. </td>
  5379. </tr>
  5380. <tr>
  5381. <td class='col-2 strong'>opts.index</td>
  5382. <td class="col-2 quiet">
  5383. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  5384. </td>
  5385. <td class='col-8'>An index inside a node’s string that should
  5386. be highlighted as the source of the warning.
  5387. </td>
  5388. </tr>
  5389. </table>
  5390. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5391. <code><a href="#warning">Warning</a></code>
  5392. :
  5393. <span class='force-inline'>Created warning object.
  5394. </span>
  5395. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5396. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> plugin = postcss.plugin(<span class="hljs-string">'postcss-deprecated'</span>, () =&gt; {
  5397. <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">root, result</span>) =&gt;</span> {
  5398. root.walkDecls(<span class="hljs-string">'bad'</span>, decl =&gt; {
  5399. decl.warn(result, <span class="hljs-string">'Deprecated property bad'</span>)
  5400. })
  5401. }
  5402. })</code></pre>
  5403. </section>
  5404. </div>
  5405. </section>
  5406. <section id='input'class='mt2 mb2 px3 py1 keyline-top'>
  5407. <div class='right py2'>
  5408. <span class="px2"></span>
  5409. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/input.js#L14-L167'>
  5410. <span>lib/input.js</span>
  5411. </a>
  5412. </div>
  5413. <h3 class='regular'>
  5414. <a class='black' href='#input'>
  5415. <code>
  5416. Input
  5417. <span class='gray'>(css, opts = {})</span>
  5418. </code>
  5419. </a>
  5420. </h3>
  5421. <p>Represents the source CSS.</p>
  5422. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5423. <thead class='fill-light'>
  5424. <th class='col-3 small caps quiet'>parameter</th>
  5425. <th class='col-3 small caps quiet'>type</th>
  5426. <th class='col-6 small caps quiet'>description</th>
  5427. </thead>
  5428. <tr>
  5429. <td class='col-3 strong'><code>css</code></td>
  5430. <td class='col-3 quiet'>
  5431. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5432. </td>
  5433. <td class='col-6'>Input CSS source.
  5434. </td>
  5435. </tr>
  5436. <tr>
  5437. <td class='col-3 strong'><code>opts</code></td>
  5438. <td class='col-3 quiet'>
  5439. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  5440. = <code>{}</code>
  5441. </td>
  5442. <td class='col-6'><a href="#processorprocess">Processor#process</a>
  5443. options.
  5444. </td>
  5445. </tr>
  5446. </table>
  5447. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5448. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(css, { <span class="hljs-attr">from</span>: file })
  5449. <span class="hljs-keyword">const</span> input = root.source.input</code></pre>
  5450. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  5451. <div class="section-indent">
  5452. <section id='inputcss'class='mt2 mb2 px3 py1 keyline-top'>
  5453. <div class='right py2'>
  5454. <span class="px2"></span>
  5455. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/input.js#L33-L33'>
  5456. <span>lib/input.js</span>
  5457. </a>
  5458. </div>
  5459. <h3 class='regular'>
  5460. <a class='black' href='#inputcss'>
  5461. <code>
  5462. css
  5463. <span class='gray'>()</span>
  5464. </code>
  5465. </a>
  5466. </h3>
  5467. <p>Input CSS source</p>
  5468. <p>
  5469. Type:
  5470. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5471. </p>
  5472. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5473. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> input = postcss.parse(<span class="hljs-string">'a{}'</span>, { <span class="hljs-attr">from</span>: file }).input
  5474. input.css <span class="hljs-comment">//=&gt; "a{}"</span></code></pre>
  5475. </section>
  5476. <section id='inputfile'class='mt2 mb2 px3 py1 keyline-top'>
  5477. <div class='right py2'>
  5478. <span class="px2"></span>
  5479. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/input.js#L54-L54'>
  5480. <span>lib/input.js</span>
  5481. </a>
  5482. </div>
  5483. <h3 class='regular'>
  5484. <a class='black' href='#inputfile'>
  5485. <code>
  5486. file
  5487. <span class='gray'>()</span>
  5488. </code>
  5489. </a>
  5490. </h3>
  5491. <p>The absolute path to the CSS source file defined
  5492. with the <code>from</code> option.</p>
  5493. <p>
  5494. Type:
  5495. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5496. </p>
  5497. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5498. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(css, { <span class="hljs-attr">from</span>: <span class="hljs-string">'a.css'</span> })
  5499. root.source.input.file <span class="hljs-comment">//=&gt; '/home/ai/a.css'</span></code></pre>
  5500. </section>
  5501. <section id='inputmap'class='mt2 mb2 px3 py1 keyline-top'>
  5502. <div class='right py2'>
  5503. <span class="px2"></span>
  5504. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/input.js#L71-L71'>
  5505. <span>lib/input.js</span>
  5506. </a>
  5507. </div>
  5508. <h3 class='regular'>
  5509. <a class='black' href='#inputmap'>
  5510. <code>
  5511. map
  5512. <span class='gray'>()</span>
  5513. </code>
  5514. </a>
  5515. </h3>
  5516. <p>The input source map passed from a compilation step before PostCSS
  5517. (for example, from Sass compiler).</p>
  5518. <p>
  5519. Type:
  5520. <a href="#previousmap">PreviousMap</a>
  5521. </p>
  5522. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5523. <pre class='p1 overflow-auto round fill-light'><code>root.source.input.map.consumer().sources <span class="hljs-comment">//=&gt; ['a.sass']</span></code></pre>
  5524. </section>
  5525. <section id='inputid'class='mt2 mb2 px3 py1 keyline-top'>
  5526. <div class='right py2'>
  5527. <span class="px2"></span>
  5528. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/input.js#L88-L88'>
  5529. <span>lib/input.js</span>
  5530. </a>
  5531. </div>
  5532. <h3 class='regular'>
  5533. <a class='black' href='#inputid'>
  5534. <code>
  5535. id
  5536. <span class='gray'>()</span>
  5537. </code>
  5538. </a>
  5539. </h3>
  5540. <p>The unique ID of the CSS source. It will be created if <code>from</code> option
  5541. is not provided (because PostCSS does not know the file path).</p>
  5542. <p>
  5543. Type:
  5544. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5545. </p>
  5546. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5547. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(css)
  5548. root.source.input.file <span class="hljs-comment">//=&gt; undefined</span>
  5549. root.source.input.id <span class="hljs-comment">//=&gt; "&lt;input css 8LZeVF&gt;"</span></code></pre>
  5550. </section>
  5551. <section id='inputorigin'class='mt2 mb2 px3 py1 keyline-top'>
  5552. <div class='right py2'>
  5553. <span class="px2"></span>
  5554. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/input.js#L125-L142'>
  5555. <span>lib/input.js</span>
  5556. </a>
  5557. </div>
  5558. <h3 class='regular'>
  5559. <a class='black' href='#inputorigin'>
  5560. <code>
  5561. origin
  5562. <span class='gray'>(line, column)</span>
  5563. </code>
  5564. </a>
  5565. </h3>
  5566. <p>Reads the input source map and returns a symbol position
  5567. in the input source (e.g., in a Sass file that was compiled
  5568. to CSS before being passed to PostCSS).</p>
  5569. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5570. <thead class='fill-light'>
  5571. <th class='col-3 small caps quiet'>parameter</th>
  5572. <th class='col-3 small caps quiet'>type</th>
  5573. <th class='col-6 small caps quiet'>description</th>
  5574. </thead>
  5575. <tr>
  5576. <td class='col-3 strong'><code>line</code></td>
  5577. <td class='col-3 quiet'>
  5578. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  5579. </td>
  5580. <td class='col-6'>Line in input CSS.
  5581. </td>
  5582. </tr>
  5583. <tr>
  5584. <td class='col-3 strong'><code>column</code></td>
  5585. <td class='col-3 quiet'>
  5586. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  5587. </td>
  5588. <td class='col-6'>Column in input CSS.
  5589. </td>
  5590. </tr>
  5591. </table>
  5592. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5593. <code><a href="#fileposition">filePosition</a></code>
  5594. :
  5595. <span class='force-inline'>Position in input source.
  5596. </span>
  5597. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5598. <pre class='p1 overflow-auto round fill-light'><code>root.source.input.origin(<span class="hljs-number">1</span>, <span class="hljs-number">1</span>) <span class="hljs-comment">//=&gt; { file: 'a.css', line: 3, column: 1 }</span></code></pre>
  5599. </section>
  5600. <section id='inputfrom'class='mt2 mb2 px3 py1 keyline-top'>
  5601. <div class='right py2'>
  5602. <span class="px2"></span>
  5603. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/input.js#L164-L166'>
  5604. <span>lib/input.js</span>
  5605. </a>
  5606. </div>
  5607. <h3 class='regular'>
  5608. <a class='black' href='#inputfrom'>
  5609. <code>
  5610. from
  5611. <span class='gray'>()</span>
  5612. </code>
  5613. </a>
  5614. </h3>
  5615. <p>The CSS source identifier. Contains <a href="#inputfile">Input#file</a> if the user
  5616. set the <code>from</code> option, or <a href="#inputid">Input#id</a> if they did not.</p>
  5617. <p>
  5618. Type:
  5619. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5620. </p>
  5621. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5622. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(css, { <span class="hljs-attr">from</span>: <span class="hljs-string">'a.css'</span> })
  5623. root.source.input.from <span class="hljs-comment">//=&gt; "/home/ai/a.css"</span>
  5624. <span class="hljs-keyword">const</span> root = postcss.parse(css)
  5625. root.source.input.from <span class="hljs-comment">//=&gt; "&lt;input css 1&gt;"</span></code></pre>
  5626. </section>
  5627. </div>
  5628. </section>
  5629. <section id='lazyresult'class='mt2 mb2 px3 py1 keyline-top'>
  5630. <div class='right py2'>
  5631. <span class="px2"></span>
  5632. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L44-L427'>
  5633. <span>lib/lazy-result.js</span>
  5634. </a>
  5635. </div>
  5636. <h3 class='regular'>
  5637. <a class='black' href='#lazyresult'>
  5638. <code>
  5639. LazyResult
  5640. <span class='gray'>(processor, css, opts)</span>
  5641. </code>
  5642. </a>
  5643. </h3>
  5644. <p>A Promise proxy for the result of PostCSS transformations.</p>
  5645. <p>A <code>LazyResult</code> instance is returned by <a href="#processorprocess">Processor#process</a>.</p>
  5646. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5647. <thead class='fill-light'>
  5648. <th class='col-3 small caps quiet'>parameter</th>
  5649. <th class='col-3 small caps quiet'>type</th>
  5650. <th class='col-6 small caps quiet'>description</th>
  5651. </thead>
  5652. <tr>
  5653. <td class='col-3 strong'><code>processor</code></td>
  5654. <td class='col-3 quiet'>
  5655. any
  5656. </td>
  5657. <td class='col-6'></td>
  5658. </tr>
  5659. <tr>
  5660. <td class='col-3 strong'><code>css</code></td>
  5661. <td class='col-3 quiet'>
  5662. any
  5663. </td>
  5664. <td class='col-6'></td>
  5665. </tr>
  5666. <tr>
  5667. <td class='col-3 strong'><code>opts</code></td>
  5668. <td class='col-3 quiet'>
  5669. any
  5670. </td>
  5671. <td class='col-6'></td>
  5672. </tr>
  5673. </table>
  5674. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5675. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> lazy = postcss([autoprefixer]).process(css)</code></pre>
  5676. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  5677. <div class="section-indent">
  5678. <section id='lazyresultprocessor'class='mt2 mb2 px3 py1 keyline-top'>
  5679. <div class='right py2'>
  5680. <span class="px2"></span>
  5681. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L81-L83'>
  5682. <span>lib/lazy-result.js</span>
  5683. </a>
  5684. </div>
  5685. <h3 class='regular'>
  5686. <a class='black' href='#lazyresultprocessor'>
  5687. <code>
  5688. processor
  5689. <span class='gray'>()</span>
  5690. </code>
  5691. </a>
  5692. </h3>
  5693. <p>Returns a <a href="#processor">Processor</a> instance, which will be used
  5694. for CSS transformations.</p>
  5695. <p>
  5696. Type:
  5697. <a href="#processor">Processor</a>
  5698. </p>
  5699. </section>
  5700. <section id='lazyresultopts'class='mt2 mb2 px3 py1 keyline-top'>
  5701. <div class='right py2'>
  5702. <span class="px2"></span>
  5703. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L90-L92'>
  5704. <span>lib/lazy-result.js</span>
  5705. </a>
  5706. </div>
  5707. <h3 class='regular'>
  5708. <a class='black' href='#lazyresultopts'>
  5709. <code>
  5710. opts
  5711. <span class='gray'>()</span>
  5712. </code>
  5713. </a>
  5714. </h3>
  5715. <p>Options from the <a href="#processorprocess">Processor#process</a> call.</p>
  5716. <p>
  5717. Type:
  5718. <a href="#processoptions">processOptions</a>
  5719. </p>
  5720. </section>
  5721. <section id='lazyresultcss'class='mt2 mb2 px3 py1 keyline-top'>
  5722. <div class='right py2'>
  5723. <span class="px2"></span>
  5724. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L106-L108'>
  5725. <span>lib/lazy-result.js</span>
  5726. </a>
  5727. </div>
  5728. <h3 class='regular'>
  5729. <a class='black' href='#lazyresultcss'>
  5730. <code>
  5731. css
  5732. <span class='gray'>()</span>
  5733. </code>
  5734. </a>
  5735. </h3>
  5736. <p>Processes input CSS through synchronous plugins, converts <code>Root</code>
  5737. to a CSS string and returns <a href="#resultcss">Result#css</a>.</p>
  5738. <p>This property will only work with synchronous plugins.
  5739. If the processor contains any asynchronous plugins
  5740. it will throw an error. This is why this method is only
  5741. for debug purpose, you should always use <a href="#lazyresultthen">LazyResult#then</a>.</p>
  5742. <p>
  5743. Type:
  5744. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5745. </p>
  5746. </section>
  5747. <section id='lazyresultcontent'class='mt2 mb2 px3 py1 keyline-top'>
  5748. <div class='right py2'>
  5749. <span class="px2"></span>
  5750. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L122-L124'>
  5751. <span>lib/lazy-result.js</span>
  5752. </a>
  5753. </div>
  5754. <h3 class='regular'>
  5755. <a class='black' href='#lazyresultcontent'>
  5756. <code>
  5757. content
  5758. <span class='gray'>()</span>
  5759. </code>
  5760. </a>
  5761. </h3>
  5762. <p>An alias for the <code>css</code> property. Use it with syntaxes
  5763. that generate non-CSS output.</p>
  5764. <p>This property will only work with synchronous plugins.
  5765. If the processor contains any asynchronous plugins
  5766. it will throw an error. This is why this method is only
  5767. for debug purpose, you should always use <a href="#lazyresultthen">LazyResult#then</a>.</p>
  5768. <p>
  5769. Type:
  5770. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  5771. </p>
  5772. </section>
  5773. <section id='lazyresultmap'class='mt2 mb2 px3 py1 keyline-top'>
  5774. <div class='right py2'>
  5775. <span class="px2"></span>
  5776. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L138-L140'>
  5777. <span>lib/lazy-result.js</span>
  5778. </a>
  5779. </div>
  5780. <h3 class='regular'>
  5781. <a class='black' href='#lazyresultmap'>
  5782. <code>
  5783. map
  5784. <span class='gray'>()</span>
  5785. </code>
  5786. </a>
  5787. </h3>
  5788. <p>Processes input CSS through synchronous plugins
  5789. and returns <a href="#resultmap">Result#map</a>.</p>
  5790. <p>This property will only work with synchronous plugins.
  5791. If the processor contains any asynchronous plugins
  5792. it will throw an error. This is why this method is only
  5793. for debug purpose, you should always use <a href="#lazyresultthen">LazyResult#then</a>.</p>
  5794. <p>
  5795. Type:
  5796. SourceMapGenerator
  5797. </p>
  5798. </section>
  5799. <section id='lazyresultroot'class='mt2 mb2 px3 py1 keyline-top'>
  5800. <div class='right py2'>
  5801. <span class="px2"></span>
  5802. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L155-L157'>
  5803. <span>lib/lazy-result.js</span>
  5804. </a>
  5805. </div>
  5806. <h3 class='regular'>
  5807. <a class='black' href='#lazyresultroot'>
  5808. <code>
  5809. root
  5810. <span class='gray'>()</span>
  5811. </code>
  5812. </a>
  5813. </h3>
  5814. <p>Processes input CSS through synchronous plugins
  5815. and returns <a href="#resultroot">Result#root</a>.</p>
  5816. <p>This property will only work with synchronous plugins. If the processor
  5817. contains any asynchronous plugins it will throw an error.</p>
  5818. <p>This is why this method is only for debug purpose,
  5819. you should always use <a href="#lazyresultthen">LazyResult#then</a>.</p>
  5820. <p>
  5821. Type:
  5822. <a href="#root">Root</a>
  5823. </p>
  5824. </section>
  5825. <section id='lazyresultmessages'class='mt2 mb2 px3 py1 keyline-top'>
  5826. <div class='right py2'>
  5827. <span class="px2"></span>
  5828. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L172-L174'>
  5829. <span>lib/lazy-result.js</span>
  5830. </a>
  5831. </div>
  5832. <h3 class='regular'>
  5833. <a class='black' href='#lazyresultmessages'>
  5834. <code>
  5835. messages
  5836. <span class='gray'>()</span>
  5837. </code>
  5838. </a>
  5839. </h3>
  5840. <p>Processes input CSS through synchronous plugins
  5841. and returns <a href="#resultmessages">Result#messages</a>.</p>
  5842. <p>This property will only work with synchronous plugins. If the processor
  5843. contains any asynchronous plugins it will throw an error.</p>
  5844. <p>This is why this method is only for debug purpose,
  5845. you should always use <a href="#lazyresultthen">LazyResult#then</a>.</p>
  5846. <p>
  5847. Type:
  5848. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#message">Message</a>>
  5849. </p>
  5850. </section>
  5851. <section id='lazyresultwarnings'class='mt2 mb2 px3 py1 keyline-top'>
  5852. <div class='right py2'>
  5853. <span class="px2"></span>
  5854. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L182-L184'>
  5855. <span>lib/lazy-result.js</span>
  5856. </a>
  5857. </div>
  5858. <h3 class='regular'>
  5859. <a class='black' href='#lazyresultwarnings'>
  5860. <code>
  5861. warnings
  5862. <span class='gray'>()</span>
  5863. </code>
  5864. </a>
  5865. </h3>
  5866. <p>Processes input CSS through synchronous plugins
  5867. and calls <a href="Result#warnings()">Result#warnings()</a>.</p>
  5868. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5869. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#warning">Warning</a>></code>
  5870. :
  5871. <span class='force-inline'>Warnings from plugins.
  5872. </span>
  5873. </section>
  5874. <section id='lazyresulttostring'class='mt2 mb2 px3 py1 keyline-top'>
  5875. <div class='right py2'>
  5876. <span class="px2"></span>
  5877. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L194-L196'>
  5878. <span>lib/lazy-result.js</span>
  5879. </a>
  5880. </div>
  5881. <h3 class='regular'>
  5882. <a class='black' href='#lazyresulttostring'>
  5883. <code>
  5884. toString
  5885. <span class='gray'>()</span>
  5886. </code>
  5887. </a>
  5888. </h3>
  5889. <p>Alias for the <a href="#lazyresultcss">LazyResult#css</a> property.</p>
  5890. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5891. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  5892. :
  5893. <span class='force-inline'>Output CSS.
  5894. </span>
  5895. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5896. <pre class='p1 overflow-auto round fill-light'><code>lazy + <span class="hljs-string">''</span> === lazy.css</code></pre>
  5897. </section>
  5898. <section id='lazyresultthen'class='mt2 mb2 px3 py1 keyline-top'>
  5899. <div class='right py2'>
  5900. <span class="px2"></span>
  5901. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L216-L227'>
  5902. <span>lib/lazy-result.js</span>
  5903. </a>
  5904. </div>
  5905. <h3 class='regular'>
  5906. <a class='black' href='#lazyresultthen'>
  5907. <code>
  5908. then
  5909. <span class='gray'>(onFulfilled, onRejected)</span>
  5910. </code>
  5911. </a>
  5912. </h3>
  5913. <p>Processes input CSS through synchronous and asynchronous plugins
  5914. and calls <code>onFulfilled</code> with a Result instance. If a plugin throws
  5915. an error, the <code>onRejected</code> callback will be executed.</p>
  5916. <p>It implements standard Promise API.</p>
  5917. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5918. <thead class='fill-light'>
  5919. <th class='col-3 small caps quiet'>parameter</th>
  5920. <th class='col-3 small caps quiet'>type</th>
  5921. <th class='col-6 small caps quiet'>description</th>
  5922. </thead>
  5923. <tr>
  5924. <td class='col-3 strong'><code>onFulfilled</code></td>
  5925. <td class='col-3 quiet'>
  5926. <a href="#onfulfilled">onFulfilled</a>
  5927. </td>
  5928. <td class='col-6'>Callback will be executed
  5929. when all plugins will finish work.
  5930. </td>
  5931. </tr>
  5932. <tr>
  5933. <td class='col-3 strong'><code>onRejected</code></td>
  5934. <td class='col-3 quiet'>
  5935. <a href="#onrejected">onRejected</a>
  5936. </td>
  5937. <td class='col-6'>Callback will be executed on any error.
  5938. </td>
  5939. </tr>
  5940. </table>
  5941. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5942. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code>
  5943. :
  5944. <span class='force-inline'>Promise API to make queue.
  5945. </span>
  5946. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5947. <pre class='p1 overflow-auto round fill-light'><code>postcss([autoprefixer]).process(css, { <span class="hljs-attr">from</span>: cssPath }).then(<span class="hljs-function"><span class="hljs-params">result</span> =&gt;</span> {
  5948. <span class="hljs-built_in">console</span>.log(result.css)
  5949. })</code></pre>
  5950. </section>
  5951. <section id='lazyresultcatch'class='mt2 mb2 px3 py1 keyline-top'>
  5952. <div class='right py2'>
  5953. <span class="px2"></span>
  5954. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L246-L248'>
  5955. <span>lib/lazy-result.js</span>
  5956. </a>
  5957. </div>
  5958. <h3 class='regular'>
  5959. <a class='black' href='#lazyresultcatch'>
  5960. <code>
  5961. catch
  5962. <span class='gray'>(onRejected)</span>
  5963. </code>
  5964. </a>
  5965. </h3>
  5966. <p>Processes input CSS through synchronous and asynchronous plugins
  5967. and calls onRejected for each error thrown in any plugin.</p>
  5968. <p>It implements standard Promise API.</p>
  5969. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  5970. <thead class='fill-light'>
  5971. <th class='col-3 small caps quiet'>parameter</th>
  5972. <th class='col-3 small caps quiet'>type</th>
  5973. <th class='col-6 small caps quiet'>description</th>
  5974. </thead>
  5975. <tr>
  5976. <td class='col-3 strong'><code>onRejected</code></td>
  5977. <td class='col-3 quiet'>
  5978. <a href="#onrejected">onRejected</a>
  5979. </td>
  5980. <td class='col-6'>Callback will be executed on any error.
  5981. </td>
  5982. </tr>
  5983. </table>
  5984. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  5985. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code>
  5986. :
  5987. <span class='force-inline'>Promise API to make queue.
  5988. </span>
  5989. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  5990. <pre class='p1 overflow-auto round fill-light'><code>postcss([autoprefixer]).process(css).then(<span class="hljs-function"><span class="hljs-params">result</span> =&gt;</span> {
  5991. <span class="hljs-built_in">console</span>.log(result.css)
  5992. }).catch(<span class="hljs-function"><span class="hljs-params">error</span> =&gt;</span> {
  5993. <span class="hljs-built_in">console</span>.error(error)
  5994. })</code></pre>
  5995. </section>
  5996. <section id='lazyresultfinally'class='mt2 mb2 px3 py1 keyline-top'>
  5997. <div class='right py2'>
  5998. <span class="px2"></span>
  5999. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L266-L268'>
  6000. <span>lib/lazy-result.js</span>
  6001. </a>
  6002. </div>
  6003. <h3 class='regular'>
  6004. <a class='black' href='#lazyresultfinally'>
  6005. <code>
  6006. finally
  6007. <span class='gray'>(onFinally)</span>
  6008. </code>
  6009. </a>
  6010. </h3>
  6011. <p>Processes input CSS through synchronous and asynchronous plugins
  6012. and calls onFinally on any error or when all plugins will finish work.</p>
  6013. <p>It implements standard Promise API.</p>
  6014. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6015. <thead class='fill-light'>
  6016. <th class='col-3 small caps quiet'>parameter</th>
  6017. <th class='col-3 small caps quiet'>type</th>
  6018. <th class='col-6 small caps quiet'>description</th>
  6019. </thead>
  6020. <tr>
  6021. <td class='col-3 strong'><code>onFinally</code></td>
  6022. <td class='col-3 quiet'>
  6023. onFinally
  6024. </td>
  6025. <td class='col-6'>Callback will be executed on any error or
  6026. when all plugins will finish work.
  6027. </td>
  6028. </tr>
  6029. </table>
  6030. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6031. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code>
  6032. :
  6033. <span class='force-inline'>Promise API to make queue.
  6034. </span>
  6035. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6036. <pre class='p1 overflow-auto round fill-light'><code>postcss([autoprefixer]).process(css).finally(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {
  6037. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'processing ended'</span>)
  6038. })</code></pre>
  6039. </section>
  6040. </div>
  6041. </section>
  6042. <section id='node'class='mt2 mb2 px3 py1 keyline-top'>
  6043. <div class='right py2'>
  6044. <span class="px2"></span>
  6045. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L35-L564'>
  6046. <span>lib/node.js</span>
  6047. </a>
  6048. </div>
  6049. <h3 class='regular'>
  6050. <a class='black' href='#node'>
  6051. <code>
  6052. Node
  6053. <span class='gray'>(defaults = {})</span>
  6054. </code>
  6055. </a>
  6056. </h3>
  6057. <p>All node classes inherit the following common methods.</p>
  6058. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6059. <thead class='fill-light'>
  6060. <th class='col-3 small caps quiet'>parameter</th>
  6061. <th class='col-3 small caps quiet'>type</th>
  6062. <th class='col-6 small caps quiet'>description</th>
  6063. </thead>
  6064. <tr>
  6065. <td class='col-3 strong'><code>defaults</code></td>
  6066. <td class='col-3 quiet'>
  6067. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  6068. = <code>{}</code>
  6069. </td>
  6070. <td class='col-6'>Value for node properties.
  6071. </td>
  6072. </tr>
  6073. </table>
  6074. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  6075. <div class="section-indent">
  6076. <section id='nodeerror'class='mt2 mb2 px3 py1 keyline-top'>
  6077. <div class='right py2'>
  6078. <span class="px2"></span>
  6079. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L89-L95'>
  6080. <span>lib/node.js</span>
  6081. </a>
  6082. </div>
  6083. <h3 class='regular'>
  6084. <a class='black' href='#nodeerror'>
  6085. <code>
  6086. error
  6087. <span class='gray'>(message, opts = {})</span>
  6088. </code>
  6089. </a>
  6090. </h3>
  6091. <p>Returns a <code>CssSyntaxError</code> instance containing the original position
  6092. of the node in the source, showing line and column numbers and also
  6093. a small excerpt to facilitate debugging.</p>
  6094. <p>If present, an input source map will be used to get the original position
  6095. of the source, even from a previous compilation step
  6096. (e.g., from Sass compilation).</p>
  6097. <p>This method produces very useful error messages.</p>
  6098. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6099. <thead class='fill-light'>
  6100. <th class='col-3 small caps quiet'>parameter</th>
  6101. <th class='col-3 small caps quiet'>type</th>
  6102. <th class='col-6 small caps quiet'>description</th>
  6103. </thead>
  6104. <tr>
  6105. <td class='col-3 strong'><code>message</code></td>
  6106. <td class='col-3 quiet'>
  6107. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  6108. </td>
  6109. <td class='col-6'>Error description.
  6110. </td>
  6111. </tr>
  6112. <tr>
  6113. <td class='col-3 strong'><code>opts</code></td>
  6114. <td class='col-3 quiet'>
  6115. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  6116. = <code>{}</code>
  6117. </td>
  6118. <td class='col-6'>Options.
  6119. </td>
  6120. </tr>
  6121. <tr>
  6122. <td class='col-2 strong'>opts.plugin</td>
  6123. <td class="col-2 quiet">
  6124. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  6125. </td>
  6126. <td class='col-8'>Plugin name that created this error.
  6127. PostCSS will set it automatically.
  6128. </td>
  6129. </tr>
  6130. <tr>
  6131. <td class='col-2 strong'>opts.word</td>
  6132. <td class="col-2 quiet">
  6133. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  6134. </td>
  6135. <td class='col-8'>A word inside a node’s string that should
  6136. be highlighted as the source of the error.
  6137. </td>
  6138. </tr>
  6139. <tr>
  6140. <td class='col-2 strong'>opts.index</td>
  6141. <td class="col-2 quiet">
  6142. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  6143. </td>
  6144. <td class='col-8'>An index inside a node’s string that should
  6145. be highlighted as the source of the error.
  6146. </td>
  6147. </tr>
  6148. </table>
  6149. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6150. <code><a href="#csssyntaxerror">CssSyntaxError</a></code>
  6151. :
  6152. <span class='force-inline'>Error object to throw it.
  6153. </span>
  6154. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6155. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (!variables[name]) {
  6156. <span class="hljs-keyword">throw</span> decl.error(<span class="hljs-string">'Unknown variable '</span> + name, { <span class="hljs-attr">word</span>: name })
  6157. <span class="hljs-comment">// CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black</span>
  6158. <span class="hljs-comment">// color: $black</span>
  6159. <span class="hljs-comment">// a</span>
  6160. <span class="hljs-comment">// ^</span>
  6161. <span class="hljs-comment">// background: white</span>
  6162. }</code></pre>
  6163. </section>
  6164. <section id='nodewarn'class='mt2 mb2 px3 py1 keyline-top'>
  6165. <div class='right py2'>
  6166. <span class="px2"></span>
  6167. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L122-L126'>
  6168. <span>lib/node.js</span>
  6169. </a>
  6170. </div>
  6171. <h3 class='regular'>
  6172. <a class='black' href='#nodewarn'>
  6173. <code>
  6174. warn
  6175. <span class='gray'>(result, text, opts?)</span>
  6176. </code>
  6177. </a>
  6178. </h3>
  6179. <p>This method is provided as a convenience wrapper for <a href="#resultwarn">Result#warn</a>.</p>
  6180. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6181. <thead class='fill-light'>
  6182. <th class='col-3 small caps quiet'>parameter</th>
  6183. <th class='col-3 small caps quiet'>type</th>
  6184. <th class='col-6 small caps quiet'>description</th>
  6185. </thead>
  6186. <tr>
  6187. <td class='col-3 strong'><code>result</code></td>
  6188. <td class='col-3 quiet'>
  6189. <a href="#result">Result</a>
  6190. </td>
  6191. <td class='col-6'>The
  6192. <a href="#result">Result</a>
  6193. instance
  6194. that will receive the warning.
  6195. </td>
  6196. </tr>
  6197. <tr>
  6198. <td class='col-3 strong'><code>text</code></td>
  6199. <td class='col-3 quiet'>
  6200. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  6201. </td>
  6202. <td class='col-6'>Warning message.
  6203. </td>
  6204. </tr>
  6205. <tr>
  6206. <td class='col-3 strong'><code>opts</code></td>
  6207. <td class='col-3 quiet'>
  6208. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  6209. </td>
  6210. <td class='col-6'>Options
  6211. </td>
  6212. </tr>
  6213. <tr>
  6214. <td class='col-2 strong'>opts.plugin</td>
  6215. <td class="col-2 quiet">
  6216. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  6217. </td>
  6218. <td class='col-8'>Plugin name that created this warning.
  6219. PostCSS will set it automatically.
  6220. </td>
  6221. </tr>
  6222. <tr>
  6223. <td class='col-2 strong'>opts.word</td>
  6224. <td class="col-2 quiet">
  6225. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  6226. </td>
  6227. <td class='col-8'>A word inside a node’s string that should
  6228. be highlighted as the source of the warning.
  6229. </td>
  6230. </tr>
  6231. <tr>
  6232. <td class='col-2 strong'>opts.index</td>
  6233. <td class="col-2 quiet">
  6234. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  6235. </td>
  6236. <td class='col-8'>An index inside a node’s string that should
  6237. be highlighted as the source of the warning.
  6238. </td>
  6239. </tr>
  6240. </table>
  6241. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6242. <code><a href="#warning">Warning</a></code>
  6243. :
  6244. <span class='force-inline'>Created warning object.
  6245. </span>
  6246. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6247. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> plugin = postcss.plugin(<span class="hljs-string">'postcss-deprecated'</span>, () =&gt; {
  6248. <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">root, result</span>) =&gt;</span> {
  6249. root.walkDecls(<span class="hljs-string">'bad'</span>, decl =&gt; {
  6250. decl.warn(result, <span class="hljs-string">'Deprecated property bad'</span>)
  6251. })
  6252. }
  6253. })</code></pre>
  6254. </section>
  6255. <section id='noderemove'class='mt2 mb2 px3 py1 keyline-top'>
  6256. <div class='right py2'>
  6257. <span class="px2"></span>
  6258. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L139-L145'>
  6259. <span>lib/node.js</span>
  6260. </a>
  6261. </div>
  6262. <h3 class='regular'>
  6263. <a class='black' href='#noderemove'>
  6264. <code>
  6265. remove
  6266. <span class='gray'>()</span>
  6267. </code>
  6268. </a>
  6269. </h3>
  6270. <p>Removes the node from its parent and cleans the parent properties
  6271. from the node and its children.</p>
  6272. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6273. <code><a href="#node">Node</a></code>
  6274. :
  6275. <span class='force-inline'>Node to make calls chain.
  6276. </span>
  6277. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6278. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (decl.prop.match(<span class="hljs-regexp">/^-webkit-/</span>)) {
  6279. decl.remove()
  6280. }</code></pre>
  6281. </section>
  6282. <section id='nodetostring'class='mt2 mb2 px3 py1 keyline-top'>
  6283. <div class='right py2'>
  6284. <span class="px2"></span>
  6285. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L158-L165'>
  6286. <span>lib/node.js</span>
  6287. </a>
  6288. </div>
  6289. <h3 class='regular'>
  6290. <a class='black' href='#nodetostring'>
  6291. <code>
  6292. toString
  6293. <span class='gray'>(stringifier = stringify)</span>
  6294. </code>
  6295. </a>
  6296. </h3>
  6297. <p>Returns a CSS string representing the node.</p>
  6298. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6299. <thead class='fill-light'>
  6300. <th class='col-3 small caps quiet'>parameter</th>
  6301. <th class='col-3 small caps quiet'>type</th>
  6302. <th class='col-6 small caps quiet'>description</th>
  6303. </thead>
  6304. <tr>
  6305. <td class='col-3 strong'><code>stringifier</code></td>
  6306. <td class='col-3 quiet'>
  6307. (<a href="#stringifier">stringifier</a> | <a href="#syntax">syntax</a>)?
  6308. = <code>stringify</code>
  6309. </td>
  6310. <td class='col-6'>A syntax to use
  6311. in string generation.
  6312. </td>
  6313. </tr>
  6314. </table>
  6315. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6316. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  6317. :
  6318. <span class='force-inline'>CSS string of this node.
  6319. </span>
  6320. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6321. <pre class='p1 overflow-auto round fill-light'><code>postcss.rule({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }).toString() <span class="hljs-comment">//=&gt; "a {}"</span></code></pre>
  6322. </section>
  6323. <section id='nodeclone'class='mt2 mb2 px3 py1 keyline-top'>
  6324. <div class='right py2'>
  6325. <span class="px2"></span>
  6326. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L183-L189'>
  6327. <span>lib/node.js</span>
  6328. </a>
  6329. </div>
  6330. <h3 class='regular'>
  6331. <a class='black' href='#nodeclone'>
  6332. <code>
  6333. clone
  6334. <span class='gray'>(overrides = {})</span>
  6335. </code>
  6336. </a>
  6337. </h3>
  6338. <p>Returns an exact clone of the node.</p>
  6339. <p>The resulting cloned node and its (cloned) children will retain
  6340. code style properties.</p>
  6341. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6342. <thead class='fill-light'>
  6343. <th class='col-3 small caps quiet'>parameter</th>
  6344. <th class='col-3 small caps quiet'>type</th>
  6345. <th class='col-6 small caps quiet'>description</th>
  6346. </thead>
  6347. <tr>
  6348. <td class='col-3 strong'><code>overrides</code></td>
  6349. <td class='col-3 quiet'>
  6350. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  6351. = <code>{}</code>
  6352. </td>
  6353. <td class='col-6'>New properties to override in the clone.
  6354. </td>
  6355. </tr>
  6356. </table>
  6357. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6358. <code><a href="#node">Node</a></code>
  6359. :
  6360. <span class='force-inline'>Clone of the node.
  6361. </span>
  6362. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6363. <pre class='p1 overflow-auto round fill-light'><code>decl.raws.before <span class="hljs-comment">//=&gt; "\n "</span>
  6364. <span class="hljs-keyword">const</span> cloned = decl.clone({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-moz-'</span> + decl.prop })
  6365. cloned.raws.before <span class="hljs-comment">//=&gt; "\n "</span>
  6366. cloned.toString() <span class="hljs-comment">//=&gt; -moz-transform: scale(0)</span></code></pre>
  6367. </section>
  6368. <section id='nodeclonebefore'class='mt2 mb2 px3 py1 keyline-top'>
  6369. <div class='right py2'>
  6370. <span class="px2"></span>
  6371. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L202-L206'>
  6372. <span>lib/node.js</span>
  6373. </a>
  6374. </div>
  6375. <h3 class='regular'>
  6376. <a class='black' href='#nodeclonebefore'>
  6377. <code>
  6378. cloneBefore
  6379. <span class='gray'>(overrides = {})</span>
  6380. </code>
  6381. </a>
  6382. </h3>
  6383. <p>Shortcut to clone the node and insert the resulting cloned node
  6384. before the current node.</p>
  6385. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6386. <thead class='fill-light'>
  6387. <th class='col-3 small caps quiet'>parameter</th>
  6388. <th class='col-3 small caps quiet'>type</th>
  6389. <th class='col-6 small caps quiet'>description</th>
  6390. </thead>
  6391. <tr>
  6392. <td class='col-3 strong'><code>overrides</code></td>
  6393. <td class='col-3 quiet'>
  6394. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  6395. = <code>{}</code>
  6396. </td>
  6397. <td class='col-6'>Mew properties to override in the clone.
  6398. </td>
  6399. </tr>
  6400. </table>
  6401. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6402. <code><a href="#node">Node</a></code>
  6403. :
  6404. <span class='force-inline'>New node
  6405. </span>
  6406. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6407. <pre class='p1 overflow-auto round fill-light'><code>decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-moz-'</span> + decl.prop })</code></pre>
  6408. </section>
  6409. <section id='nodecloneafter'class='mt2 mb2 px3 py1 keyline-top'>
  6410. <div class='right py2'>
  6411. <span class="px2"></span>
  6412. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L216-L220'>
  6413. <span>lib/node.js</span>
  6414. </a>
  6415. </div>
  6416. <h3 class='regular'>
  6417. <a class='black' href='#nodecloneafter'>
  6418. <code>
  6419. cloneAfter
  6420. <span class='gray'>(overrides = {})</span>
  6421. </code>
  6422. </a>
  6423. </h3>
  6424. <p>Shortcut to clone the node and insert the resulting cloned node
  6425. after the current node.</p>
  6426. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6427. <thead class='fill-light'>
  6428. <th class='col-3 small caps quiet'>parameter</th>
  6429. <th class='col-3 small caps quiet'>type</th>
  6430. <th class='col-6 small caps quiet'>description</th>
  6431. </thead>
  6432. <tr>
  6433. <td class='col-3 strong'><code>overrides</code></td>
  6434. <td class='col-3 quiet'>
  6435. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  6436. = <code>{}</code>
  6437. </td>
  6438. <td class='col-6'>New properties to override in the clone.
  6439. </td>
  6440. </tr>
  6441. </table>
  6442. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6443. <code><a href="#node">Node</a></code>
  6444. :
  6445. <span class='force-inline'>New node.
  6446. </span>
  6447. </section>
  6448. <section id='nodereplacewith'class='mt2 mb2 px3 py1 keyline-top'>
  6449. <div class='right py2'>
  6450. <span class="px2"></span>
  6451. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L234-L244'>
  6452. <span>lib/node.js</span>
  6453. </a>
  6454. </div>
  6455. <h3 class='regular'>
  6456. <a class='black' href='#nodereplacewith'>
  6457. <code>
  6458. replaceWith
  6459. <span class='gray'>(nodes)</span>
  6460. </code>
  6461. </a>
  6462. </h3>
  6463. <p>Inserts node(s) before the current node and removes the current node.</p>
  6464. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6465. <thead class='fill-light'>
  6466. <th class='col-3 small caps quiet'>parameter</th>
  6467. <th class='col-3 small caps quiet'>type</th>
  6468. <th class='col-6 small caps quiet'>description</th>
  6469. </thead>
  6470. <tr>
  6471. <td class='col-3 strong'><code>nodes</code></td>
  6472. <td class='col-3 quiet'>
  6473. ...<a href="#node">Node</a>
  6474. </td>
  6475. <td class='col-6'>Mode(s) to replace current one.
  6476. </td>
  6477. </tr>
  6478. </table>
  6479. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6480. <code><a href="#node">Node</a></code>
  6481. :
  6482. <span class='force-inline'>Current node to methods chain.
  6483. </span>
  6484. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6485. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (atrule.name === <span class="hljs-string">'mixin'</span>) {
  6486. atrule.replaceWith(mixinRules[atrule.params])
  6487. }</code></pre>
  6488. </section>
  6489. <section id='nodenext'class='mt2 mb2 px3 py1 keyline-top'>
  6490. <div class='right py2'>
  6491. <span class="px2"></span>
  6492. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L260-L264'>
  6493. <span>lib/node.js</span>
  6494. </a>
  6495. </div>
  6496. <h3 class='regular'>
  6497. <a class='black' href='#nodenext'>
  6498. <code>
  6499. next
  6500. <span class='gray'>()</span>
  6501. </code>
  6502. </a>
  6503. </h3>
  6504. <p>Returns the next child of the node’s parent.
  6505. Returns <code>undefined</code> if the current node is the last child.</p>
  6506. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6507. <code>(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  6508. :
  6509. <span class='force-inline'>Next node.
  6510. </span>
  6511. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6512. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (comment.text === <span class="hljs-string">'delete next'</span>) {
  6513. <span class="hljs-keyword">const</span> next = comment.next()
  6514. <span class="hljs-keyword">if</span> (next) {
  6515. next.remove()
  6516. }
  6517. }</code></pre>
  6518. </section>
  6519. <section id='nodeprev'class='mt2 mb2 px3 py1 keyline-top'>
  6520. <div class='right py2'>
  6521. <span class="px2"></span>
  6522. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L278-L282'>
  6523. <span>lib/node.js</span>
  6524. </a>
  6525. </div>
  6526. <h3 class='regular'>
  6527. <a class='black' href='#nodeprev'>
  6528. <code>
  6529. prev
  6530. <span class='gray'>()</span>
  6531. </code>
  6532. </a>
  6533. </h3>
  6534. <p>Returns the previous child of the node’s parent.
  6535. Returns <code>undefined</code> if the current node is the first child.</p>
  6536. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6537. <code>(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  6538. :
  6539. <span class='force-inline'>Previous node.
  6540. </span>
  6541. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6542. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> annotation = decl.prev()
  6543. <span class="hljs-keyword">if</span> (annotation.type === <span class="hljs-string">'comment'</span>) {
  6544. readAnnotation(annotation.text)
  6545. }</code></pre>
  6546. </section>
  6547. <section id='nodebefore'class='mt2 mb2 px3 py1 keyline-top'>
  6548. <div class='right py2'>
  6549. <span class="px2"></span>
  6550. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L296-L299'>
  6551. <span>lib/node.js</span>
  6552. </a>
  6553. </div>
  6554. <h3 class='regular'>
  6555. <a class='black' href='#nodebefore'>
  6556. <code>
  6557. before
  6558. <span class='gray'>(add)</span>
  6559. </code>
  6560. </a>
  6561. </h3>
  6562. <p>Insert new node before current node to current node’s parent.</p>
  6563. <p>Just alias for <code>node.parent.insertBefore(node, add)</code>.</p>
  6564. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6565. <thead class='fill-light'>
  6566. <th class='col-3 small caps quiet'>parameter</th>
  6567. <th class='col-3 small caps quiet'>type</th>
  6568. <th class='col-6 small caps quiet'>description</th>
  6569. </thead>
  6570. <tr>
  6571. <td class='col-3 strong'><code>add</code></td>
  6572. <td class='col-3 quiet'>
  6573. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  6574. </td>
  6575. <td class='col-6'>New node.
  6576. </td>
  6577. </tr>
  6578. </table>
  6579. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6580. <code><a href="#node">Node</a></code>
  6581. :
  6582. <span class='force-inline'>This node for methods chain.
  6583. </span>
  6584. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6585. <pre class='p1 overflow-auto round fill-light'><code>decl.before(<span class="hljs-string">'content: ""'</span>)</code></pre>
  6586. </section>
  6587. <section id='nodeafter'class='mt2 mb2 px3 py1 keyline-top'>
  6588. <div class='right py2'>
  6589. <span class="px2"></span>
  6590. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L313-L316'>
  6591. <span>lib/node.js</span>
  6592. </a>
  6593. </div>
  6594. <h3 class='regular'>
  6595. <a class='black' href='#nodeafter'>
  6596. <code>
  6597. after
  6598. <span class='gray'>(add)</span>
  6599. </code>
  6600. </a>
  6601. </h3>
  6602. <p>Insert new node after current node to current node’s parent.</p>
  6603. <p>Just alias for <code>node.parent.insertAfter(node, add)</code>.</p>
  6604. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6605. <thead class='fill-light'>
  6606. <th class='col-3 small caps quiet'>parameter</th>
  6607. <th class='col-3 small caps quiet'>type</th>
  6608. <th class='col-6 small caps quiet'>description</th>
  6609. </thead>
  6610. <tr>
  6611. <td class='col-3 strong'><code>add</code></td>
  6612. <td class='col-3 quiet'>
  6613. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  6614. </td>
  6615. <td class='col-6'>New node.
  6616. </td>
  6617. </tr>
  6618. </table>
  6619. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6620. <code><a href="#node">Node</a></code>
  6621. :
  6622. <span class='force-inline'>This node for methods chain.
  6623. </span>
  6624. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6625. <pre class='p1 overflow-auto round fill-light'><code>decl.after(<span class="hljs-string">'color: black'</span>)</code></pre>
  6626. </section>
  6627. <section id='noderaw'class='mt2 mb2 px3 py1 keyline-top'>
  6628. <div class='right py2'>
  6629. <span class="px2"></span>
  6630. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L363-L366'>
  6631. <span>lib/node.js</span>
  6632. </a>
  6633. </div>
  6634. <h3 class='regular'>
  6635. <a class='black' href='#noderaw'>
  6636. <code>
  6637. raw
  6638. <span class='gray'>(prop, defaultType?)</span>
  6639. </code>
  6640. </a>
  6641. </h3>
  6642. <p>Returns a <a href="Node#raws">Node#raws</a> value. If the node is missing
  6643. the code style property (because the node was manually built or cloned),
  6644. PostCSS will try to autodetect the code style property by looking
  6645. at other nodes in the tree.</p>
  6646. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6647. <thead class='fill-light'>
  6648. <th class='col-3 small caps quiet'>parameter</th>
  6649. <th class='col-3 small caps quiet'>type</th>
  6650. <th class='col-6 small caps quiet'>description</th>
  6651. </thead>
  6652. <tr>
  6653. <td class='col-3 strong'><code>prop</code></td>
  6654. <td class='col-3 quiet'>
  6655. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  6656. </td>
  6657. <td class='col-6'>Name of code style property.
  6658. </td>
  6659. </tr>
  6660. <tr>
  6661. <td class='col-3 strong'><code>defaultType</code></td>
  6662. <td class='col-3 quiet'>
  6663. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>?
  6664. </td>
  6665. <td class='col-6'>Name of default value, it can be missed
  6666. if the value is the same as prop.
  6667. </td>
  6668. </tr>
  6669. </table>
  6670. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6671. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  6672. :
  6673. <span class='force-inline'>Code style value.
  6674. </span>
  6675. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6676. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a { background: white }'</span>)
  6677. root.nodes[<span class="hljs-number">0</span>].append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  6678. root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">1</span>].raws.before <span class="hljs-comment">//=&gt; undefined</span>
  6679. root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">1</span>].raw(<span class="hljs-string">'before'</span>) <span class="hljs-comment">//=&gt; ' '</span></code></pre>
  6680. </section>
  6681. <section id='noderoot'class='mt2 mb2 px3 py1 keyline-top'>
  6682. <div class='right py2'>
  6683. <span class="px2"></span>
  6684. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L376-L380'>
  6685. <span>lib/node.js</span>
  6686. </a>
  6687. </div>
  6688. <h3 class='regular'>
  6689. <a class='black' href='#noderoot'>
  6690. <code>
  6691. root
  6692. <span class='gray'>()</span>
  6693. </code>
  6694. </a>
  6695. </h3>
  6696. <p>Finds the Root instance of the node’s tree.</p>
  6697. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6698. <code><a href="#root">Root</a></code>
  6699. :
  6700. <span class='force-inline'>Root parent.
  6701. </span>
  6702. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6703. <pre class='p1 overflow-auto round fill-light'><code>root.nodes[<span class="hljs-number">0</span>].nodes[<span class="hljs-number">0</span>].root() === root</code></pre>
  6704. </section>
  6705. <section id='nodecleanraws'class='mt2 mb2 px3 py1 keyline-top'>
  6706. <div class='right py2'>
  6707. <span class="px2"></span>
  6708. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L394-L398'>
  6709. <span>lib/node.js</span>
  6710. </a>
  6711. </div>
  6712. <h3 class='regular'>
  6713. <a class='black' href='#nodecleanraws'>
  6714. <code>
  6715. cleanRaws
  6716. <span class='gray'>(keepBetween?)</span>
  6717. </code>
  6718. </a>
  6719. </h3>
  6720. <p>Clear the code style properties for the node and its children.</p>
  6721. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6722. <thead class='fill-light'>
  6723. <th class='col-3 small caps quiet'>parameter</th>
  6724. <th class='col-3 small caps quiet'>type</th>
  6725. <th class='col-6 small caps quiet'>description</th>
  6726. </thead>
  6727. <tr>
  6728. <td class='col-3 strong'><code>keepBetween</code></td>
  6729. <td class='col-3 quiet'>
  6730. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>?
  6731. </td>
  6732. <td class='col-6'>Keep the raws.between symbols.
  6733. </td>
  6734. </tr>
  6735. </table>
  6736. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6737. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a></code>
  6738. :
  6739. <span class='force-inline'>
  6740. </span>
  6741. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6742. <pre class='p1 overflow-auto round fill-light'><code>node.raws.before <span class="hljs-comment">//=&gt; ' '</span>
  6743. node.cleanRaws()
  6744. node.raws.before <span class="hljs-comment">//=&gt; undefined</span></code></pre>
  6745. </section>
  6746. </div>
  6747. </section>
  6748. <section id='previousmap'class='mt2 mb2 px3 py1 keyline-top'>
  6749. <div class='right py2'>
  6750. <span class="px2"></span>
  6751. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/previous-map.js#L24-L140'>
  6752. <span>lib/previous-map.js</span>
  6753. </a>
  6754. </div>
  6755. <h3 class='regular'>
  6756. <a class='black' href='#previousmap'>
  6757. <code>
  6758. PreviousMap
  6759. <span class='gray'>(css, opts?)</span>
  6760. </code>
  6761. </a>
  6762. </h3>
  6763. <p>Source map information from input CSS.
  6764. For example, source map after Sass compiler.</p>
  6765. <p>This class will automatically find source map in input CSS or in file system
  6766. near input file (according <code>from</code> option).</p>
  6767. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6768. <thead class='fill-light'>
  6769. <th class='col-3 small caps quiet'>parameter</th>
  6770. <th class='col-3 small caps quiet'>type</th>
  6771. <th class='col-6 small caps quiet'>description</th>
  6772. </thead>
  6773. <tr>
  6774. <td class='col-3 strong'><code>css</code></td>
  6775. <td class='col-3 quiet'>
  6776. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  6777. </td>
  6778. <td class='col-6'>Input CSS source.
  6779. </td>
  6780. </tr>
  6781. <tr>
  6782. <td class='col-3 strong'><code>opts</code></td>
  6783. <td class='col-3 quiet'>
  6784. <a href="#processoptions">processOptions</a>?
  6785. </td>
  6786. <td class='col-6'><a href="#processorprocess">Processor#process</a>
  6787. options.
  6788. </td>
  6789. </tr>
  6790. </table>
  6791. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6792. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(css, { <span class="hljs-attr">from</span>: <span class="hljs-string">'a.sass.css'</span> })
  6793. root.input.map <span class="hljs-comment">//=&gt; PreviousMap</span></code></pre>
  6794. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  6795. <div class="section-indent">
  6796. <section id='previousmapinline'class='mt2 mb2 px3 py1 keyline-top'>
  6797. <div class='right py2'>
  6798. <span class="px2"></span>
  6799. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/previous-map.js#L36-L36'>
  6800. <span>lib/previous-map.js</span>
  6801. </a>
  6802. </div>
  6803. <h3 class='regular'>
  6804. <a class='black' href='#previousmapinline'>
  6805. <code>
  6806. inline
  6807. <span class='gray'>()</span>
  6808. </code>
  6809. </a>
  6810. </h3>
  6811. <p>Was source map inlined by data-uri to input CSS.</p>
  6812. <p>
  6813. Type:
  6814. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>
  6815. </p>
  6816. </section>
  6817. <section id='previousmapconsumer'class='mt2 mb2 px3 py1 keyline-top'>
  6818. <div class='right py2'>
  6819. <span class="px2"></span>
  6820. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/previous-map.js#L52-L57'>
  6821. <span>lib/previous-map.js</span>
  6822. </a>
  6823. </div>
  6824. <h3 class='regular'>
  6825. <a class='black' href='#previousmapconsumer'>
  6826. <code>
  6827. consumer
  6828. <span class='gray'>()</span>
  6829. </code>
  6830. </a>
  6831. </h3>
  6832. <p>Create a instance of <code>SourceMapGenerator</code> class
  6833. from the <code>source-map</code> library to work with source map information.</p>
  6834. <p>It is lazy method, so it will create object only on first call
  6835. and then it will use cache.</p>
  6836. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6837. <code>SourceMapGenerator</code>
  6838. :
  6839. <span class='force-inline'>Object with source map information.
  6840. </span>
  6841. </section>
  6842. <section id='previousmapwithcontent'class='mt2 mb2 px3 py1 keyline-top'>
  6843. <div class='right py2'>
  6844. <span class="px2"></span>
  6845. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/previous-map.js#L64-L67'>
  6846. <span>lib/previous-map.js</span>
  6847. </a>
  6848. </div>
  6849. <h3 class='regular'>
  6850. <a class='black' href='#previousmapwithcontent'>
  6851. <code>
  6852. withContent
  6853. <span class='gray'>()</span>
  6854. </code>
  6855. </a>
  6856. </h3>
  6857. <p>Does source map contains <code>sourcesContent</code> with input source text.</p>
  6858. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  6859. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  6860. :
  6861. <span class='force-inline'>Is
  6862. <code>sourcesContent</code>
  6863. present.
  6864. </span>
  6865. </section>
  6866. </div>
  6867. </section>
  6868. <section id='processor'class='mt2 mb2 px3 py1 keyline-top'>
  6869. <div class='right py2'>
  6870. <span class="px2"></span>
  6871. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L12-L135'>
  6872. <span>lib/processor.js</span>
  6873. </a>
  6874. </div>
  6875. <h3 class='regular'>
  6876. <a class='black' href='#processor'>
  6877. <code>
  6878. Processor
  6879. <span class='gray'>(plugins)</span>
  6880. </code>
  6881. </a>
  6882. </h3>
  6883. <p>Contains plugins to process CSS. Create one <code>Processor</code> instance,
  6884. initialize its plugins, and then use that instance on numerous CSS files.</p>
  6885. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6886. <thead class='fill-light'>
  6887. <th class='col-3 small caps quiet'>parameter</th>
  6888. <th class='col-3 small caps quiet'>type</th>
  6889. <th class='col-6 small caps quiet'>description</th>
  6890. </thead>
  6891. <tr>
  6892. <td class='col-3 strong'><code>plugins</code></td>
  6893. <td class='col-3 quiet'>
  6894. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;(<a href="#plugin">Plugin</a> | <a href="#pluginfunction">pluginFunction</a>)> | <a href="#processor">Processor</a>)
  6895. = <code>[]</code>
  6896. </td>
  6897. <td class='col-6'>PostCSS plugins.
  6898. See
  6899. <a href="#processoruse">Processor#use</a>
  6900. for plugin format.
  6901. </td>
  6902. </tr>
  6903. </table>
  6904. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6905. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> processor = postcss([autoprefixer, precss])
  6906. processor.process(css1).then(<span class="hljs-function"><span class="hljs-params">result</span> =&gt;</span> <span class="hljs-built_in">console</span>.log(result.css))
  6907. processor.process(css2).then(<span class="hljs-function"><span class="hljs-params">result</span> =&gt;</span> <span class="hljs-built_in">console</span>.log(result.css))</code></pre>
  6908. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  6909. <div class="section-indent">
  6910. <section id='processorversion'class='mt2 mb2 px3 py1 keyline-top'>
  6911. <div class='right py2'>
  6912. <span class="px2"></span>
  6913. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L28-L28'>
  6914. <span>lib/processor.js</span>
  6915. </a>
  6916. </div>
  6917. <h3 class='regular'>
  6918. <a class='black' href='#processorversion'>
  6919. <code>
  6920. version
  6921. <span class='gray'>()</span>
  6922. </code>
  6923. </a>
  6924. </h3>
  6925. <p>Current PostCSS version.</p>
  6926. <p>
  6927. Type:
  6928. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  6929. </p>
  6930. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6931. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (result.processor.version.split(<span class="hljs-string">'.'</span>)[<span class="hljs-number">0</span>] !== <span class="hljs-string">'6'</span>) {
  6932. <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">'This plugin works only with PostCSS 6'</span>)
  6933. }</code></pre>
  6934. </section>
  6935. <section id='processorplugins'class='mt2 mb2 px3 py1 keyline-top'>
  6936. <div class='right py2'>
  6937. <span class="px2"></span>
  6938. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L38-L38'>
  6939. <span>lib/processor.js</span>
  6940. </a>
  6941. </div>
  6942. <h3 class='regular'>
  6943. <a class='black' href='#processorplugins'>
  6944. <code>
  6945. plugins
  6946. <span class='gray'>()</span>
  6947. </code>
  6948. </a>
  6949. </h3>
  6950. <p>Plugins added to this processor.</p>
  6951. <p>
  6952. Type:
  6953. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#pluginfunction">pluginFunction</a>>
  6954. </p>
  6955. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  6956. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> processor = postcss([autoprefixer, precss])
  6957. processor.plugins.length <span class="hljs-comment">//=&gt; 2</span></code></pre>
  6958. </section>
  6959. <section id='processoruse'class='mt2 mb2 px3 py1 keyline-top'>
  6960. <div class='right py2'>
  6961. <span class="px2"></span>
  6962. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L70-L73'>
  6963. <span>lib/processor.js</span>
  6964. </a>
  6965. </div>
  6966. <h3 class='regular'>
  6967. <a class='black' href='#processoruse'>
  6968. <code>
  6969. use
  6970. <span class='gray'>(plugin)</span>
  6971. </code>
  6972. </a>
  6973. </h3>
  6974. <p>Adds a plugin to be used as a CSS processor.</p>
  6975. <p>PostCSS plugin can be in 4 formats:</p>
  6976. <ul>
  6977. <li>A plugin created by <a href="#postcssplugin">postcss.plugin</a> method.</li>
  6978. <li>A function. PostCSS will pass the function a @{link Root}
  6979. as the first argument and current <a href="#result">Result</a> instance
  6980. as the second.</li>
  6981. <li>An object with a <code>postcss</code> method. PostCSS will use that method
  6982. as described in #2.</li>
  6983. <li>Another <a href="#processor">Processor</a> instance. PostCSS will copy plugins
  6984. from that instance into this one.</li>
  6985. </ul>
  6986. <p>Plugins can also be added by passing them as arguments when creating
  6987. a <code>postcss</code> instance (see [<code>postcss(plugins)</code>]).</p>
  6988. <p>Asynchronous plugins should return a <code>Promise</code> instance.</p>
  6989. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  6990. <thead class='fill-light'>
  6991. <th class='col-3 small caps quiet'>parameter</th>
  6992. <th class='col-3 small caps quiet'>type</th>
  6993. <th class='col-6 small caps quiet'>description</th>
  6994. </thead>
  6995. <tr>
  6996. <td class='col-3 strong'><code>plugin</code></td>
  6997. <td class='col-3 quiet'>
  6998. (<a href="#plugin">Plugin</a> | <a href="#pluginfunction">pluginFunction</a> | <a href="#processor">Processor</a>)
  6999. </td>
  7000. <td class='col-6'>PostCSS plugin
  7001. or
  7002. <a href="#processor">Processor</a>
  7003. with plugins.
  7004. </td>
  7005. </tr>
  7006. </table>
  7007. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7008. <code>Processes</code>
  7009. :
  7010. <span class='force-inline'>Current processor to make methods chain.
  7011. </span>
  7012. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7013. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> processor = postcss()
  7014. .use(autoprefixer)
  7015. .use(precss)</code></pre>
  7016. </section>
  7017. <section id='processorprocess'class='mt2 mb2 px3 py1 keyline-top'>
  7018. <div class='right py2'>
  7019. <span class="px2"></span>
  7020. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L97-L110'>
  7021. <span>lib/processor.js</span>
  7022. </a>
  7023. </div>
  7024. <h3 class='regular'>
  7025. <a class='black' href='#processorprocess'>
  7026. <code>
  7027. process
  7028. <span class='gray'>(css, opts = {})</span>
  7029. </code>
  7030. </a>
  7031. </h3>
  7032. <p>Parses source CSS and returns a <a href="#lazyresult">LazyResult</a> Promise proxy.
  7033. Because some plugins can be asynchronous it doesn’t make
  7034. any transformations. Transformations will be applied
  7035. in the <a href="#lazyresult">LazyResult</a> methods.</p>
  7036. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7037. <thead class='fill-light'>
  7038. <th class='col-3 small caps quiet'>parameter</th>
  7039. <th class='col-3 small caps quiet'>type</th>
  7040. <th class='col-6 small caps quiet'>description</th>
  7041. </thead>
  7042. <tr>
  7043. <td class='col-3 strong'><code>css</code></td>
  7044. <td class='col-3 quiet'>
  7045. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="#tostring">toString</a> | <a href="#result">Result</a>)
  7046. </td>
  7047. <td class='col-6'>String with input CSS or any object
  7048. with a
  7049. <code>toString()</code>
  7050. method,
  7051. like a Buffer. Optionally, send
  7052. a
  7053. <a href="#result">Result</a>
  7054. instance
  7055. and the processor will take
  7056. the
  7057. <a href="#root">Root</a>
  7058. from it.
  7059. </td>
  7060. </tr>
  7061. <tr>
  7062. <td class='col-3 strong'><code>opts</code></td>
  7063. <td class='col-3 quiet'>
  7064. <a href="#processoptions">processOptions</a>?
  7065. = <code>{}</code>
  7066. </td>
  7067. <td class='col-6'>Options.
  7068. </td>
  7069. </tr>
  7070. </table>
  7071. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7072. <code><a href="#lazyresult">LazyResult</a></code>
  7073. :
  7074. <span class='force-inline'>Promise proxy.
  7075. </span>
  7076. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7077. <pre class='p1 overflow-auto round fill-light'><code>processor.process(css, { <span class="hljs-attr">from</span>: <span class="hljs-string">'a.css'</span>, <span class="hljs-attr">to</span>: <span class="hljs-string">'a.out.css'</span> })
  7078. .then(<span class="hljs-function"><span class="hljs-params">result</span> =&gt;</span> {
  7079. <span class="hljs-built_in">console</span>.log(result.css)
  7080. })</code></pre>
  7081. </section>
  7082. </div>
  7083. </section>
  7084. <section id='result'class='mt2 mb2 px3 py1 keyline-top'>
  7085. <div class='right py2'>
  7086. <span class="px2"></span>
  7087. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L17-L170'>
  7088. <span>lib/result.js</span>
  7089. </a>
  7090. </div>
  7091. <h3 class='regular'>
  7092. <a class='black' href='#result'>
  7093. <code>
  7094. Result
  7095. <span class='gray'>(processor, root, opts)</span>
  7096. </code>
  7097. </a>
  7098. </h3>
  7099. <p>Provides the result of the PostCSS transformations.</p>
  7100. <p>A Result instance is returned by <a href="#lazyresultthen">LazyResult#then</a>
  7101. or <a href="#roottoresult">Root#toResult</a> methods.</p>
  7102. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7103. <thead class='fill-light'>
  7104. <th class='col-3 small caps quiet'>parameter</th>
  7105. <th class='col-3 small caps quiet'>type</th>
  7106. <th class='col-6 small caps quiet'>description</th>
  7107. </thead>
  7108. <tr>
  7109. <td class='col-3 strong'><code>processor</code></td>
  7110. <td class='col-3 quiet'>
  7111. <a href="#processor">Processor</a>
  7112. </td>
  7113. <td class='col-6'>Processor used for this transformation.
  7114. </td>
  7115. </tr>
  7116. <tr>
  7117. <td class='col-3 strong'><code>root</code></td>
  7118. <td class='col-3 quiet'>
  7119. <a href="#root">Root</a>
  7120. </td>
  7121. <td class='col-6'>Root node after all transformations.
  7122. </td>
  7123. </tr>
  7124. <tr>
  7125. <td class='col-3 strong'><code>opts</code></td>
  7126. <td class='col-3 quiet'>
  7127. <a href="#processoptions">processOptions</a>
  7128. </td>
  7129. <td class='col-6'>Options from the
  7130. <a href="#processorprocess">Processor#process</a>
  7131. or
  7132. <a href="#roottoresult">Root#toResult</a>
  7133. .
  7134. </td>
  7135. </tr>
  7136. </table>
  7137. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7138. <pre class='p1 overflow-auto round fill-light'><code>postcss([autoprefixer]).process(css).then(<span class="hljs-function"><span class="hljs-params">result</span> =&gt;</span> {
  7139. <span class="hljs-built_in">console</span>.log(result.css)
  7140. })</code></pre>
  7141. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> result2 = postcss.parse(css).toResult()</code></pre>
  7142. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  7143. <div class="section-indent">
  7144. <section id='resultprocessor'class='mt2 mb2 px3 py1 keyline-top'>
  7145. <div class='right py2'>
  7146. <span class="px2"></span>
  7147. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L37-L37'>
  7148. <span>lib/result.js</span>
  7149. </a>
  7150. </div>
  7151. <h3 class='regular'>
  7152. <a class='black' href='#resultprocessor'>
  7153. <code>
  7154. processor
  7155. <span class='gray'>()</span>
  7156. </code>
  7157. </a>
  7158. </h3>
  7159. <p>The Processor instance used for this transformation.</p>
  7160. <p>
  7161. Type:
  7162. <a href="#processor">Processor</a>
  7163. </p>
  7164. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7165. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> plugin <span class="hljs-keyword">of</span> result.processor.plugins) {
  7166. <span class="hljs-keyword">if</span> (plugin.postcssPlugin === <span class="hljs-string">'postcss-bad'</span>) {
  7167. <span class="hljs-keyword">throw</span> <span class="hljs-string">'postcss-good is incompatible with postcss-bad'</span>
  7168. }
  7169. })</code></pre>
  7170. </section>
  7171. <section id='resultmessages'class='mt2 mb2 px3 py1 keyline-top'>
  7172. <div class='right py2'>
  7173. <span class="px2"></span>
  7174. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L56-L56'>
  7175. <span>lib/result.js</span>
  7176. </a>
  7177. </div>
  7178. <h3 class='regular'>
  7179. <a class='black' href='#resultmessages'>
  7180. <code>
  7181. messages
  7182. <span class='gray'>()</span>
  7183. </code>
  7184. </a>
  7185. </h3>
  7186. <p>Contains messages from plugins (e.g., warnings or custom messages).
  7187. Each message should have type and plugin properties.</p>
  7188. <p>
  7189. Type:
  7190. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#message">Message</a>>
  7191. </p>
  7192. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7193. <pre class='p1 overflow-auto round fill-light'><code>postcss.plugin(<span class="hljs-string">'postcss-min-browser'</span>, () =&gt; {
  7194. <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">root, result</span>) =&gt;</span> {
  7195. <span class="hljs-keyword">const</span> browsers = detectMinBrowsersByCanIUse(root)
  7196. result.messages.push({
  7197. <span class="hljs-attr">type</span>: <span class="hljs-string">'min-browser'</span>,
  7198. <span class="hljs-attr">plugin</span>: <span class="hljs-string">'postcss-min-browser'</span>,
  7199. browsers
  7200. })
  7201. }
  7202. })</code></pre>
  7203. </section>
  7204. <section id='resultroot'class='mt2 mb2 px3 py1 keyline-top'>
  7205. <div class='right py2'>
  7206. <span class="px2"></span>
  7207. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L65-L65'>
  7208. <span>lib/result.js</span>
  7209. </a>
  7210. </div>
  7211. <h3 class='regular'>
  7212. <a class='black' href='#resultroot'>
  7213. <code>
  7214. root
  7215. <span class='gray'>()</span>
  7216. </code>
  7217. </a>
  7218. </h3>
  7219. <p>Root node after all transformations.</p>
  7220. <p>
  7221. Type:
  7222. <a href="#root">Root</a>
  7223. </p>
  7224. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7225. <pre class='p1 overflow-auto round fill-light'><code>root.toResult().root === root</code></pre>
  7226. </section>
  7227. <section id='resultopts'class='mt2 mb2 px3 py1 keyline-top'>
  7228. <div class='right py2'>
  7229. <span class="px2"></span>
  7230. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L75-L75'>
  7231. <span>lib/result.js</span>
  7232. </a>
  7233. </div>
  7234. <h3 class='regular'>
  7235. <a class='black' href='#resultopts'>
  7236. <code>
  7237. opts
  7238. <span class='gray'>()</span>
  7239. </code>
  7240. </a>
  7241. </h3>
  7242. <p>Options from the <a href="#processorprocess">Processor#process</a> or <a href="#roottoresult">Root#toResult</a> call
  7243. that produced this Result instance.</p>
  7244. <p>
  7245. Type:
  7246. <a href="#processoptions">processOptions</a>
  7247. </p>
  7248. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7249. <pre class='p1 overflow-auto round fill-light'><code>root.toResult(opts).opts === opts</code></pre>
  7250. </section>
  7251. <section id='resultcss'class='mt2 mb2 px3 py1 keyline-top'>
  7252. <div class='right py2'>
  7253. <span class="px2"></span>
  7254. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L84-L84'>
  7255. <span>lib/result.js</span>
  7256. </a>
  7257. </div>
  7258. <h3 class='regular'>
  7259. <a class='black' href='#resultcss'>
  7260. <code>
  7261. css
  7262. <span class='gray'>()</span>
  7263. </code>
  7264. </a>
  7265. </h3>
  7266. <p>A CSS string representing of <a href="#resultroot">Result#root</a>.</p>
  7267. <p>
  7268. Type:
  7269. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  7270. </p>
  7271. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7272. <pre class='p1 overflow-auto round fill-light'><code>postcss.parse(<span class="hljs-string">'a{}'</span>).toResult().css <span class="hljs-comment">//=&gt; "a{}"</span></code></pre>
  7273. </section>
  7274. <section id='resultmap'class='mt2 mb2 px3 py1 keyline-top'>
  7275. <div class='right py2'>
  7276. <span class="px2"></span>
  7277. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L99-L99'>
  7278. <span>lib/result.js</span>
  7279. </a>
  7280. </div>
  7281. <h3 class='regular'>
  7282. <a class='black' href='#resultmap'>
  7283. <code>
  7284. map
  7285. <span class='gray'>()</span>
  7286. </code>
  7287. </a>
  7288. </h3>
  7289. <p>An instance of <code>SourceMapGenerator</code> class from the <code>source-map</code> library,
  7290. representing changes to the <a href="#resultroot">Result#root</a> instance.</p>
  7291. <p>
  7292. Type:
  7293. SourceMapGenerator
  7294. </p>
  7295. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7296. <pre class='p1 overflow-auto round fill-light'><code>result.map.toJSON() <span class="hljs-comment">//=&gt; { version: 3, file: 'a.css', … }</span></code></pre>
  7297. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (result.map) {
  7298. fs.writeFileSync(result.opts.to + <span class="hljs-string">'.map'</span>, result.map.toString())
  7299. }</code></pre>
  7300. </section>
  7301. <section id='resulttostring'class='mt2 mb2 px3 py1 keyline-top'>
  7302. <div class='right py2'>
  7303. <span class="px2"></span>
  7304. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L110-L112'>
  7305. <span>lib/result.js</span>
  7306. </a>
  7307. </div>
  7308. <h3 class='regular'>
  7309. <a class='black' href='#resulttostring'>
  7310. <code>
  7311. toString
  7312. <span class='gray'>()</span>
  7313. </code>
  7314. </a>
  7315. </h3>
  7316. <p>Returns for @{link Result#css} content.</p>
  7317. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7318. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  7319. :
  7320. <span class='force-inline'>String representing of
  7321. <a href="#resultroot">Result#root</a>
  7322. .
  7323. </span>
  7324. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7325. <pre class='p1 overflow-auto round fill-light'><code>result + <span class="hljs-string">''</span> === result.css</code></pre>
  7326. </section>
  7327. <section id='resultwarn'class='mt2 mb2 px3 py1 keyline-top'>
  7328. <div class='right py2'>
  7329. <span class="px2"></span>
  7330. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L130-L141'>
  7331. <span>lib/result.js</span>
  7332. </a>
  7333. </div>
  7334. <h3 class='regular'>
  7335. <a class='black' href='#resultwarn'>
  7336. <code>
  7337. warn
  7338. <span class='gray'>(text, opts = {})</span>
  7339. </code>
  7340. </a>
  7341. </h3>
  7342. <p>Creates an instance of <a href="#warning">Warning</a> and adds it
  7343. to <a href="#resultmessages">Result#messages</a>.</p>
  7344. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7345. <thead class='fill-light'>
  7346. <th class='col-3 small caps quiet'>parameter</th>
  7347. <th class='col-3 small caps quiet'>type</th>
  7348. <th class='col-6 small caps quiet'>description</th>
  7349. </thead>
  7350. <tr>
  7351. <td class='col-3 strong'><code>text</code></td>
  7352. <td class='col-3 quiet'>
  7353. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  7354. </td>
  7355. <td class='col-6'>Warning message.
  7356. </td>
  7357. </tr>
  7358. <tr>
  7359. <td class='col-3 strong'><code>opts</code></td>
  7360. <td class='col-3 quiet'>
  7361. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>?
  7362. = <code>{}</code>
  7363. </td>
  7364. <td class='col-6'>Warning options.
  7365. </td>
  7366. </tr>
  7367. <tr>
  7368. <td class='col-2 strong'>opts.node</td>
  7369. <td class="col-2 quiet">
  7370. <a href="#node">Node</a>
  7371. </td>
  7372. <td class='col-8'>CSS node that caused the warning.
  7373. </td>
  7374. </tr>
  7375. <tr>
  7376. <td class='col-2 strong'>opts.word</td>
  7377. <td class="col-2 quiet">
  7378. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  7379. </td>
  7380. <td class='col-8'>Word in CSS source that caused the warning.
  7381. </td>
  7382. </tr>
  7383. <tr>
  7384. <td class='col-2 strong'>opts.index</td>
  7385. <td class="col-2 quiet">
  7386. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  7387. </td>
  7388. <td class='col-8'>Index in CSS node string that caused
  7389. the warning.
  7390. </td>
  7391. </tr>
  7392. <tr>
  7393. <td class='col-2 strong'>opts.plugin</td>
  7394. <td class="col-2 quiet">
  7395. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  7396. </td>
  7397. <td class='col-8'>Name of the plugin that created
  7398. this warning.
  7399. <a href="#resultwarn">Result#warn</a>
  7400. fills
  7401. this property automatically.
  7402. </td>
  7403. </tr>
  7404. </table>
  7405. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7406. <code><a href="#warning">Warning</a></code>
  7407. :
  7408. <span class='force-inline'>Created warning.
  7409. </span>
  7410. </section>
  7411. <section id='resultwarnings'class='mt2 mb2 px3 py1 keyline-top'>
  7412. <div class='right py2'>
  7413. <span class="px2"></span>
  7414. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L154-L156'>
  7415. <span>lib/result.js</span>
  7416. </a>
  7417. </div>
  7418. <h3 class='regular'>
  7419. <a class='black' href='#resultwarnings'>
  7420. <code>
  7421. warnings
  7422. <span class='gray'>()</span>
  7423. </code>
  7424. </a>
  7425. </h3>
  7426. <p>Returns warnings from plugins. Filters <a href="#warning">Warning</a> instances
  7427. from <a href="#resultmessages">Result#messages</a>.</p>
  7428. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7429. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#warning">Warning</a>></code>
  7430. :
  7431. <span class='force-inline'>Warnings from plugins.
  7432. </span>
  7433. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7434. <pre class='p1 overflow-auto round fill-light'><code>result.warnings().forEach(<span class="hljs-function"><span class="hljs-params">warn</span> =&gt;</span> {
  7435. <span class="hljs-built_in">console</span>.warn(warn.toString())
  7436. })</code></pre>
  7437. </section>
  7438. <section id='resultcontent'class='mt2 mb2 px3 py1 keyline-top'>
  7439. <div class='right py2'>
  7440. <span class="px2"></span>
  7441. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L167-L169'>
  7442. <span>lib/result.js</span>
  7443. </a>
  7444. </div>
  7445. <h3 class='regular'>
  7446. <a class='black' href='#resultcontent'>
  7447. <code>
  7448. content
  7449. <span class='gray'>()</span>
  7450. </code>
  7451. </a>
  7452. </h3>
  7453. <p>An alias for the <a href="#resultcss">Result#css</a> property.
  7454. Use it with syntaxes that generate non-CSS output.</p>
  7455. <p>
  7456. Type:
  7457. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  7458. </p>
  7459. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7460. <pre class='p1 overflow-auto round fill-light'><code>result.css === result.content</code></pre>
  7461. </section>
  7462. </div>
  7463. </section>
  7464. <section id='root'class='mt2 mb2 px3 py1 keyline-top'>
  7465. <div class='right py2'>
  7466. <span class='font-smaller'>
  7467. Extends
  7468. <a href="#container">Container</a>
  7469. </span>
  7470. <span class="px2"></span>
  7471. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/root.js#L13-L116'>
  7472. <span>lib/root.js</span>
  7473. </a>
  7474. </div>
  7475. <h3 class='regular'>
  7476. <a class='black' href='#root'>
  7477. <code>
  7478. Root
  7479. <span class='gray'>(defaults)</span>
  7480. </code>
  7481. </a>
  7482. </h3>
  7483. <p>Represents a CSS file and contains all its parsed nodes.</p>
  7484. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7485. <thead class='fill-light'>
  7486. <th class='col-3 small caps quiet'>parameter</th>
  7487. <th class='col-3 small caps quiet'>type</th>
  7488. <th class='col-6 small caps quiet'>description</th>
  7489. </thead>
  7490. <tr>
  7491. <td class='col-3 strong'><code>defaults</code></td>
  7492. <td class='col-3 quiet'>
  7493. any
  7494. </td>
  7495. <td class='col-6'></td>
  7496. </tr>
  7497. </table>
  7498. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7499. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a{color:black} b{z-index:2}'</span>)
  7500. root.type <span class="hljs-comment">//=&gt; 'root'</span>
  7501. root.nodes.length <span class="hljs-comment">//=&gt; 2</span></code></pre>
  7502. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  7503. <div class="section-indent">
  7504. <section id='rootappend'class='mt2 mb2 px3 py1 keyline-top'>
  7505. <div class='right py2'>
  7506. <span class="px2"></span>
  7507. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L322-L331'>
  7508. <span>lib/container.js</span>
  7509. </a>
  7510. </div>
  7511. <h3 class='regular'>
  7512. <a class='black' href='#rootappend'>
  7513. <code>
  7514. append
  7515. <span class='gray'>(children)</span>
  7516. </code>
  7517. </a>
  7518. </h3>
  7519. <p>Inserts new nodes to the end of the container.</p>
  7520. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7521. <thead class='fill-light'>
  7522. <th class='col-3 small caps quiet'>parameter</th>
  7523. <th class='col-3 small caps quiet'>type</th>
  7524. <th class='col-6 small caps quiet'>description</th>
  7525. </thead>
  7526. <tr>
  7527. <td class='col-3 strong'><code>children</code></td>
  7528. <td class='col-3 quiet'>
  7529. ...(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  7530. </td>
  7531. <td class='col-6'>New nodes.
  7532. </td>
  7533. </tr>
  7534. </table>
  7535. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7536. <code><a href="#node">Node</a></code>
  7537. :
  7538. <span class='force-inline'>This node for methods chain.
  7539. </span>
  7540. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7541. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> decl1 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  7542. <span class="hljs-keyword">const</span> decl2 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'background-color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'white'</span> })
  7543. rule.append(decl1, decl2)
  7544. root.append({ <span class="hljs-attr">name</span>: <span class="hljs-string">'charset'</span>, <span class="hljs-attr">params</span>: <span class="hljs-string">'"UTF-8"'</span> }) <span class="hljs-comment">// at-rule</span>
  7545. root.append({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }) <span class="hljs-comment">// rule</span>
  7546. rule.append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> }) <span class="hljs-comment">// declaration</span>
  7547. rule.append({ <span class="hljs-attr">text</span>: <span class="hljs-string">'Comment'</span> }) <span class="hljs-comment">// comment</span>
  7548. root.append(<span class="hljs-string">'a {}'</span>)
  7549. root.first.append(<span class="hljs-string">'color: black; z-index: 1'</span>)</code></pre>
  7550. </section>
  7551. <section id='rooteach'class='mt2 mb2 px3 py1 keyline-top'>
  7552. <div class='right py2'>
  7553. <span class="px2"></span>
  7554. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L63-L89'>
  7555. <span>lib/container.js</span>
  7556. </a>
  7557. </div>
  7558. <h3 class='regular'>
  7559. <a class='black' href='#rooteach'>
  7560. <code>
  7561. each
  7562. <span class='gray'>(callback)</span>
  7563. </code>
  7564. </a>
  7565. </h3>
  7566. <p>Iterates through the container’s immediate children,
  7567. calling <code>callback</code> for each child.</p>
  7568. <p>Returning <code>false</code> in the callback will break iteration.</p>
  7569. <p>This method only iterates through the container’s immediate children.
  7570. If you need to recursively iterate through all the container’s descendant
  7571. nodes, use <a href="#containerwalk">Container#walk</a>.</p>
  7572. <p>Unlike the for <code>{}</code>-cycle or <code>Array#forEach</code> this iterator is safe
  7573. if you are mutating the array of child nodes during iteration.
  7574. PostCSS will adjust the current index to match the mutations.</p>
  7575. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7576. <thead class='fill-light'>
  7577. <th class='col-3 small caps quiet'>parameter</th>
  7578. <th class='col-3 small caps quiet'>type</th>
  7579. <th class='col-6 small caps quiet'>description</th>
  7580. </thead>
  7581. <tr>
  7582. <td class='col-3 strong'><code>callback</code></td>
  7583. <td class='col-3 quiet'>
  7584. <a href="#childiterator">childIterator</a>
  7585. </td>
  7586. <td class='col-6'>Iterator receives each node and index.
  7587. </td>
  7588. </tr>
  7589. </table>
  7590. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7591. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  7592. :
  7593. <span class='force-inline'>Returns
  7594. <code>false</code>
  7595. if iteration was broke.
  7596. </span>
  7597. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7598. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a { color: black; z-index: 1 }'</span>)
  7599. <span class="hljs-keyword">const</span> rule = root.first
  7600. <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> decl <span class="hljs-keyword">of</span> rule.nodes) {
  7601. decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop })
  7602. <span class="hljs-comment">// Cycle will be infinite, because cloneBefore moves the current node</span>
  7603. <span class="hljs-comment">// to the next index</span>
  7604. }
  7605. rule.each(<span class="hljs-function"><span class="hljs-params">decl</span> =&gt;</span> {
  7606. decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop })
  7607. <span class="hljs-comment">// Will be executed only for color and z-index</span>
  7608. })</code></pre>
  7609. </section>
  7610. <section id='rootevery'class='mt2 mb2 px3 py1 keyline-top'>
  7611. <div class='right py2'>
  7612. <span class="px2"></span>
  7613. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L539-L541'>
  7614. <span>lib/container.js</span>
  7615. </a>
  7616. </div>
  7617. <h3 class='regular'>
  7618. <a class='black' href='#rootevery'>
  7619. <code>
  7620. every
  7621. <span class='gray'>(condition)</span>
  7622. </code>
  7623. </a>
  7624. </h3>
  7625. <p>Returns <code>true</code> if callback returns <code>true</code>
  7626. for all of the container’s children.</p>
  7627. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7628. <thead class='fill-light'>
  7629. <th class='col-3 small caps quiet'>parameter</th>
  7630. <th class='col-3 small caps quiet'>type</th>
  7631. <th class='col-6 small caps quiet'>description</th>
  7632. </thead>
  7633. <tr>
  7634. <td class='col-3 strong'><code>condition</code></td>
  7635. <td class='col-3 quiet'>
  7636. <a href="#childcondition">childCondition</a>
  7637. </td>
  7638. <td class='col-6'>Iterator returns true or false.
  7639. </td>
  7640. </tr>
  7641. </table>
  7642. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7643. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  7644. :
  7645. <span class='force-inline'>Is every child pass condition.
  7646. </span>
  7647. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7648. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> noPrefixes = rule.every(<span class="hljs-function"><span class="hljs-params">i</span> =&gt;</span> i.prop[<span class="hljs-number">0</span>] !== <span class="hljs-string">'-'</span>)</code></pre>
  7649. </section>
  7650. <section id='rootfirst'class='mt2 mb2 px3 py1 keyline-top'>
  7651. <div class='right py2'>
  7652. <span class="px2"></span>
  7653. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L582-L585'>
  7654. <span>lib/container.js</span>
  7655. </a>
  7656. </div>
  7657. <h3 class='regular'>
  7658. <a class='black' href='#rootfirst'>
  7659. <code>
  7660. first
  7661. <span class='gray'>()</span>
  7662. </code>
  7663. </a>
  7664. </h3>
  7665. <p>The container’s first child.</p>
  7666. <p>
  7667. Type:
  7668. <a href="#node">Node</a>
  7669. </p>
  7670. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7671. <pre class='p1 overflow-auto round fill-light'><code>rule.first === rules.nodes[<span class="hljs-number">0</span>]</code></pre>
  7672. </section>
  7673. <section id='rootindex'class='mt2 mb2 px3 py1 keyline-top'>
  7674. <div class='right py2'>
  7675. <span class="px2"></span>
  7676. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L568-L572'>
  7677. <span>lib/container.js</span>
  7678. </a>
  7679. </div>
  7680. <h3 class='regular'>
  7681. <a class='black' href='#rootindex'>
  7682. <code>
  7683. index
  7684. <span class='gray'>(child)</span>
  7685. </code>
  7686. </a>
  7687. </h3>
  7688. <p>Returns a <code>child</code>’s index within the <a href="Container#nodes">Container#nodes</a> array.</p>
  7689. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7690. <thead class='fill-light'>
  7691. <th class='col-3 small caps quiet'>parameter</th>
  7692. <th class='col-3 small caps quiet'>type</th>
  7693. <th class='col-6 small caps quiet'>description</th>
  7694. </thead>
  7695. <tr>
  7696. <td class='col-3 strong'><code>child</code></td>
  7697. <td class='col-3 quiet'>
  7698. <a href="#node">Node</a>
  7699. </td>
  7700. <td class='col-6'>Child of the current container.
  7701. </td>
  7702. </tr>
  7703. </table>
  7704. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7705. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
  7706. :
  7707. <span class='force-inline'>Child index.
  7708. </span>
  7709. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7710. <pre class='p1 overflow-auto round fill-light'><code>rule.index( rule.nodes[<span class="hljs-number">2</span>] ) <span class="hljs-comment">//=&gt; 2</span></code></pre>
  7711. </section>
  7712. <section id='rootinsertafter'class='mt2 mb2 px3 py1 keyline-top'>
  7713. <div class='right py2'>
  7714. <span class="px2"></span>
  7715. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L414-L431'>
  7716. <span>lib/container.js</span>
  7717. </a>
  7718. </div>
  7719. <h3 class='regular'>
  7720. <a class='black' href='#rootinsertafter'>
  7721. <code>
  7722. insertAfter
  7723. <span class='gray'>(exist, add)</span>
  7724. </code>
  7725. </a>
  7726. </h3>
  7727. <p>Insert new node after old node within the container.</p>
  7728. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7729. <thead class='fill-light'>
  7730. <th class='col-3 small caps quiet'>parameter</th>
  7731. <th class='col-3 small caps quiet'>type</th>
  7732. <th class='col-6 small caps quiet'>description</th>
  7733. </thead>
  7734. <tr>
  7735. <td class='col-3 strong'><code>exist</code></td>
  7736. <td class='col-3 quiet'>
  7737. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  7738. </td>
  7739. <td class='col-6'>Child or child’s index.
  7740. </td>
  7741. </tr>
  7742. <tr>
  7743. <td class='col-3 strong'><code>add</code></td>
  7744. <td class='col-3 quiet'>
  7745. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  7746. </td>
  7747. <td class='col-6'>New node.
  7748. </td>
  7749. </tr>
  7750. </table>
  7751. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7752. <code><a href="#node">Node</a></code>
  7753. :
  7754. <span class='force-inline'>This node for methods chain.
  7755. </span>
  7756. </section>
  7757. <section id='rootinsertbefore'class='mt2 mb2 px3 py1 keyline-top'>
  7758. <div class='right py2'>
  7759. <span class="px2"></span>
  7760. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L386-L404'>
  7761. <span>lib/container.js</span>
  7762. </a>
  7763. </div>
  7764. <h3 class='regular'>
  7765. <a class='black' href='#rootinsertbefore'>
  7766. <code>
  7767. insertBefore
  7768. <span class='gray'>(exist, add)</span>
  7769. </code>
  7770. </a>
  7771. </h3>
  7772. <p>Insert new node before old node within the container.</p>
  7773. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7774. <thead class='fill-light'>
  7775. <th class='col-3 small caps quiet'>parameter</th>
  7776. <th class='col-3 small caps quiet'>type</th>
  7777. <th class='col-6 small caps quiet'>description</th>
  7778. </thead>
  7779. <tr>
  7780. <td class='col-3 strong'><code>exist</code></td>
  7781. <td class='col-3 quiet'>
  7782. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  7783. </td>
  7784. <td class='col-6'>Child or child’s index.
  7785. </td>
  7786. </tr>
  7787. <tr>
  7788. <td class='col-3 strong'><code>add</code></td>
  7789. <td class='col-3 quiet'>
  7790. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  7791. </td>
  7792. <td class='col-6'>New node.
  7793. </td>
  7794. </tr>
  7795. </table>
  7796. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7797. <code><a href="#node">Node</a></code>
  7798. :
  7799. <span class='force-inline'>This node for methods chain.
  7800. </span>
  7801. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7802. <pre class='p1 overflow-auto round fill-light'><code>rule.insertBefore(decl, decl.clone({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop }))</code></pre>
  7803. </section>
  7804. <section id='rootlast'class='mt2 mb2 px3 py1 keyline-top'>
  7805. <div class='right py2'>
  7806. <span class="px2"></span>
  7807. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L595-L598'>
  7808. <span>lib/container.js</span>
  7809. </a>
  7810. </div>
  7811. <h3 class='regular'>
  7812. <a class='black' href='#rootlast'>
  7813. <code>
  7814. last
  7815. <span class='gray'>()</span>
  7816. </code>
  7817. </a>
  7818. </h3>
  7819. <p>The container’s last child.</p>
  7820. <p>
  7821. Type:
  7822. <a href="#node">Node</a>
  7823. </p>
  7824. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7825. <pre class='p1 overflow-auto round fill-light'><code>rule.last === rule.nodes[rule.nodes.length - <span class="hljs-number">1</span>]</code></pre>
  7826. </section>
  7827. <section id='rooton'class='mt2 mb2 px3 py1 keyline-top'>
  7828. <div class='right py2'>
  7829. <span class="px2"></span>
  7830. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/root.js#L95-L99'>
  7831. <span>lib/root.js</span>
  7832. </a>
  7833. </div>
  7834. <h3 class='regular'>
  7835. <a class='black' href='#rooton'>
  7836. <code>
  7837. on
  7838. <span class='gray'>(event, visitor?, type?)</span>
  7839. </code>
  7840. </a>
  7841. </h3>
  7842. <p>Add visitor for next PostCSS walk.</p>
  7843. <p>Visitor subscribes for events. Each event contain node type (<code>atrule</code>,
  7844. <code>rule</code>, <code>decl</code>, <code>comment</code>) and phase (<code>enter</code>, <code>exit</code>) separated with dot.
  7845. The default phase is <code>enter</code>. As result possible events could be like
  7846. <code>comment.enter</code>, <code>decl.exit</code> or <code>rule</code> (equal to <code>rule.enter</code>).</p>
  7847. <p>PostCSS will walk through CSS AST and call visitor according current node.
  7848. Visitor will receive node and node’s index.</p>
  7849. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7850. <thead class='fill-light'>
  7851. <th class='col-3 small caps quiet'>parameter</th>
  7852. <th class='col-3 small caps quiet'>type</th>
  7853. <th class='col-6 small caps quiet'>description</th>
  7854. </thead>
  7855. <tr>
  7856. <td class='col-3 strong'><code>event</code></td>
  7857. <td class='col-3 quiet'>
  7858. any
  7859. </td>
  7860. <td class='col-6'></td>
  7861. </tr>
  7862. <tr>
  7863. <td class='col-3 strong'><code>visitor</code></td>
  7864. <td class='col-3 quiet'>
  7865. <a href="#visitor">visitor</a>?
  7866. </td>
  7867. <td class='col-6'>Function receives node and index.
  7868. </td>
  7869. </tr>
  7870. <tr>
  7871. <td class='col-3 strong'><code>type</code></td>
  7872. <td class='col-3 quiet'>
  7873. visitingEvent?
  7874. </td>
  7875. <td class='col-6'>The type of the node and phase.
  7876. </td>
  7877. </tr>
  7878. </table>
  7879. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7880. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a></code>
  7881. :
  7882. <span class='force-inline'>
  7883. </span>
  7884. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7885. <pre class='p1 overflow-auto round fill-light'><code>css.on(<span class="hljs-string">'decl'</span>, (node, index) =&gt; {
  7886. <span class="hljs-keyword">if</span> (node.prop === <span class="hljs-string">'will-change'</span>) {
  7887. node.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'backface-visibility'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'hidden'</span> })
  7888. }
  7889. })</code></pre>
  7890. </section>
  7891. <section id='rootprepend'class='mt2 mb2 px3 py1 keyline-top'>
  7892. <div class='right py2'>
  7893. <span class="px2"></span>
  7894. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L353-L366'>
  7895. <span>lib/container.js</span>
  7896. </a>
  7897. </div>
  7898. <h3 class='regular'>
  7899. <a class='black' href='#rootprepend'>
  7900. <code>
  7901. prepend
  7902. <span class='gray'>(children)</span>
  7903. </code>
  7904. </a>
  7905. </h3>
  7906. <p>Inserts new nodes to the start of the container.</p>
  7907. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7908. <thead class='fill-light'>
  7909. <th class='col-3 small caps quiet'>parameter</th>
  7910. <th class='col-3 small caps quiet'>type</th>
  7911. <th class='col-6 small caps quiet'>description</th>
  7912. </thead>
  7913. <tr>
  7914. <td class='col-3 strong'><code>children</code></td>
  7915. <td class='col-3 quiet'>
  7916. ...(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  7917. </td>
  7918. <td class='col-6'>New nodes.
  7919. </td>
  7920. </tr>
  7921. </table>
  7922. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7923. <code><a href="#node">Node</a></code>
  7924. :
  7925. <span class='force-inline'>This node for methods chain.
  7926. </span>
  7927. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7928. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> decl1 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  7929. <span class="hljs-keyword">const</span> decl2 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'background-color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'white'</span> })
  7930. rule.prepend(decl1, decl2)
  7931. root.append({ <span class="hljs-attr">name</span>: <span class="hljs-string">'charset'</span>, <span class="hljs-attr">params</span>: <span class="hljs-string">'"UTF-8"'</span> }) <span class="hljs-comment">// at-rule</span>
  7932. root.append({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }) <span class="hljs-comment">// rule</span>
  7933. rule.append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> }) <span class="hljs-comment">// declaration</span>
  7934. rule.append({ <span class="hljs-attr">text</span>: <span class="hljs-string">'Comment'</span> }) <span class="hljs-comment">// comment</span>
  7935. root.append(<span class="hljs-string">'a {}'</span>)
  7936. root.first.append(<span class="hljs-string">'color: black; z-index: 1'</span>)</code></pre>
  7937. </section>
  7938. <section id='rootremoveall'class='mt2 mb2 px3 py1 keyline-top'>
  7939. <div class='right py2'>
  7940. <span class="px2"></span>
  7941. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L475-L482'>
  7942. <span>lib/container.js</span>
  7943. </a>
  7944. </div>
  7945. <h3 class='regular'>
  7946. <a class='black' href='#rootremoveall'>
  7947. <code>
  7948. removeAll
  7949. <span class='gray'>()</span>
  7950. </code>
  7951. </a>
  7952. </h3>
  7953. <p>Removes all children from the container
  7954. and cleans their parent properties.</p>
  7955. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7956. <code><a href="#node">Node</a></code>
  7957. :
  7958. <span class='force-inline'>This node for methods chain.
  7959. </span>
  7960. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  7961. <pre class='p1 overflow-auto round fill-light'><code>rule.removeAll()
  7962. rule.nodes.length <span class="hljs-comment">//=&gt; 0</span></code></pre>
  7963. </section>
  7964. <section id='rootremovechild'class='mt2 mb2 px3 py1 keyline-top'>
  7965. <div class='right py2'>
  7966. <span class="px2"></span>
  7967. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L447-L463'>
  7968. <span>lib/container.js</span>
  7969. </a>
  7970. </div>
  7971. <h3 class='regular'>
  7972. <a class='black' href='#rootremovechild'>
  7973. <code>
  7974. removeChild
  7975. <span class='gray'>(child)</span>
  7976. </code>
  7977. </a>
  7978. </h3>
  7979. <p>Removes node from the container and cleans the parent properties
  7980. from the node and its children.</p>
  7981. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  7982. <thead class='fill-light'>
  7983. <th class='col-3 small caps quiet'>parameter</th>
  7984. <th class='col-3 small caps quiet'>type</th>
  7985. <th class='col-6 small caps quiet'>description</th>
  7986. </thead>
  7987. <tr>
  7988. <td class='col-3 strong'><code>child</code></td>
  7989. <td class='col-3 quiet'>
  7990. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  7991. </td>
  7992. <td class='col-6'>Child or child’s index.
  7993. </td>
  7994. </tr>
  7995. </table>
  7996. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  7997. <code><a href="#node">Node</a></code>
  7998. :
  7999. <span class='force-inline'>This node for methods chain
  8000. </span>
  8001. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8002. <pre class='p1 overflow-auto round fill-light'><code>rule.nodes.length <span class="hljs-comment">//=&gt; 5</span>
  8003. rule.removeChild(decl)
  8004. rule.nodes.length <span class="hljs-comment">//=&gt; 4</span>
  8005. decl.parent <span class="hljs-comment">//=&gt; undefined</span></code></pre>
  8006. </section>
  8007. <section id='rootreplacevalues'class='mt2 mb2 px3 py1 keyline-top'>
  8008. <div class='right py2'>
  8009. <span class="px2"></span>
  8010. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L510-L526'>
  8011. <span>lib/container.js</span>
  8012. </a>
  8013. </div>
  8014. <h3 class='regular'>
  8015. <a class='black' href='#rootreplacevalues'>
  8016. <code>
  8017. replaceValues
  8018. <span class='gray'>(pattern, opts, callback)</span>
  8019. </code>
  8020. </a>
  8021. </h3>
  8022. <p>Passes all declaration values within the container that match pattern
  8023. through callback, replacing those values with the returned result
  8024. of callback.</p>
  8025. <p>This method is useful if you are using a custom unit or function
  8026. and need to iterate through all values.</p>
  8027. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8028. <thead class='fill-light'>
  8029. <th class='col-3 small caps quiet'>parameter</th>
  8030. <th class='col-3 small caps quiet'>type</th>
  8031. <th class='col-6 small caps quiet'>description</th>
  8032. </thead>
  8033. <tr>
  8034. <td class='col-3 strong'><code>pattern</code></td>
  8035. <td class='col-3 quiet'>
  8036. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)
  8037. </td>
  8038. <td class='col-6'>Replace pattern.
  8039. </td>
  8040. </tr>
  8041. <tr>
  8042. <td class='col-3 strong'><code>opts</code></td>
  8043. <td class='col-3 quiet'>
  8044. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  8045. </td>
  8046. <td class='col-6'>Options to speed up the search.
  8047. </td>
  8048. </tr>
  8049. <tr>
  8050. <td class='col-2 strong'>opts.props</td>
  8051. <td class="col-2 quiet">
  8052. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>)
  8053. </td>
  8054. <td class='col-8'>An array of property names.
  8055. </td>
  8056. </tr>
  8057. <tr>
  8058. <td class='col-2 strong'>opts.fast</td>
  8059. <td class="col-2 quiet">
  8060. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  8061. </td>
  8062. <td class='col-8'>String that’s used to narrow down
  8063. values and speed up the regexp search.
  8064. </td>
  8065. </tr>
  8066. <tr>
  8067. <td class='col-3 strong'><code>callback</code></td>
  8068. <td class='col-3 quiet'>
  8069. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)
  8070. </td>
  8071. <td class='col-6'>String to replace pattern or callback
  8072. that returns a new value. The callback
  8073. will receive the same arguments
  8074. as those passed to a function parameter
  8075. of
  8076. <code>String#replace</code>
  8077. .
  8078. </td>
  8079. </tr>
  8080. </table>
  8081. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8082. <code><a href="#node">Node</a></code>
  8083. :
  8084. <span class='force-inline'>This node for methods chain.
  8085. </span>
  8086. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8087. <pre class='p1 overflow-auto round fill-light'><code>root.replaceValues(<span class="hljs-regexp">/\d+rem/</span>, { <span class="hljs-attr">fast</span>: <span class="hljs-string">'rem'</span> }, string =&gt; {
  8088. <span class="hljs-keyword">return</span> <span class="hljs-number">15</span> * <span class="hljs-built_in">parseInt</span>(string) + <span class="hljs-string">'px'</span>
  8089. })</code></pre>
  8090. </section>
  8091. <section id='rootsome'class='mt2 mb2 px3 py1 keyline-top'>
  8092. <div class='right py2'>
  8093. <span class="px2"></span>
  8094. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L554-L556'>
  8095. <span>lib/container.js</span>
  8096. </a>
  8097. </div>
  8098. <h3 class='regular'>
  8099. <a class='black' href='#rootsome'>
  8100. <code>
  8101. some
  8102. <span class='gray'>(condition)</span>
  8103. </code>
  8104. </a>
  8105. </h3>
  8106. <p>Returns <code>true</code> if callback returns <code>true</code> for (at least) one
  8107. of the container’s children.</p>
  8108. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8109. <thead class='fill-light'>
  8110. <th class='col-3 small caps quiet'>parameter</th>
  8111. <th class='col-3 small caps quiet'>type</th>
  8112. <th class='col-6 small caps quiet'>description</th>
  8113. </thead>
  8114. <tr>
  8115. <td class='col-3 strong'><code>condition</code></td>
  8116. <td class='col-3 quiet'>
  8117. <a href="#childcondition">childCondition</a>
  8118. </td>
  8119. <td class='col-6'>Iterator returns true or false.
  8120. </td>
  8121. </tr>
  8122. </table>
  8123. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8124. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  8125. :
  8126. <span class='force-inline'>Is some child pass condition.
  8127. </span>
  8128. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8129. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> hasPrefix = rule.some(<span class="hljs-function"><span class="hljs-params">i</span> =&gt;</span> i.prop[<span class="hljs-number">0</span>] === <span class="hljs-string">'-'</span>)</code></pre>
  8130. </section>
  8131. <section id='roottoresult'class='mt2 mb2 px3 py1 keyline-top'>
  8132. <div class='right py2'>
  8133. <span class="px2"></span>
  8134. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/root.js#L64-L70'>
  8135. <span>lib/root.js</span>
  8136. </a>
  8137. </div>
  8138. <h3 class='regular'>
  8139. <a class='black' href='#roottoresult'>
  8140. <code>
  8141. toResult
  8142. <span class='gray'>(opts = {})</span>
  8143. </code>
  8144. </a>
  8145. </h3>
  8146. <p>Returns a <a href="#result">Result</a> instance representing the root’s CSS.</p>
  8147. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8148. <thead class='fill-light'>
  8149. <th class='col-3 small caps quiet'>parameter</th>
  8150. <th class='col-3 small caps quiet'>type</th>
  8151. <th class='col-6 small caps quiet'>description</th>
  8152. </thead>
  8153. <tr>
  8154. <td class='col-3 strong'><code>opts</code></td>
  8155. <td class='col-3 quiet'>
  8156. <a href="#processoptions">processOptions</a>?
  8157. = <code>{}</code>
  8158. </td>
  8159. <td class='col-6'>Options with only
  8160. <code>to</code>
  8161. and
  8162. <code>map</code>
  8163. keys.
  8164. </td>
  8165. </tr>
  8166. </table>
  8167. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8168. <code><a href="#result">Result</a></code>
  8169. :
  8170. <span class='force-inline'>Result with current root’s CSS.
  8171. </span>
  8172. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8173. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root1 = postcss.parse(css1, { <span class="hljs-attr">from</span>: <span class="hljs-string">'a.css'</span> })
  8174. <span class="hljs-keyword">const</span> root2 = postcss.parse(css2, { <span class="hljs-attr">from</span>: <span class="hljs-string">'b.css'</span> })
  8175. root1.append(root2)
  8176. <span class="hljs-keyword">const</span> result = root1.toResult({ <span class="hljs-attr">to</span>: <span class="hljs-string">'all.css'</span>, <span class="hljs-attr">map</span>: <span class="hljs-literal">true</span> })</code></pre>
  8177. </section>
  8178. <section id='rootwalk'class='mt2 mb2 px3 py1 keyline-top'>
  8179. <div class='right py2'>
  8180. <span class="px2"></span>
  8181. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L110-L124'>
  8182. <span>lib/container.js</span>
  8183. </a>
  8184. </div>
  8185. <h3 class='regular'>
  8186. <a class='black' href='#rootwalk'>
  8187. <code>
  8188. walk
  8189. <span class='gray'>(callback)</span>
  8190. </code>
  8191. </a>
  8192. </h3>
  8193. <p>Traverses the container’s descendant nodes, calling callback
  8194. for each node.</p>
  8195. <p>Like container.each(), this method is safe to use
  8196. if you are mutating arrays during iteration.</p>
  8197. <p>If you only need to iterate through the container’s immediate children,
  8198. use <a href="#containereach">Container#each</a>.</p>
  8199. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8200. <thead class='fill-light'>
  8201. <th class='col-3 small caps quiet'>parameter</th>
  8202. <th class='col-3 small caps quiet'>type</th>
  8203. <th class='col-6 small caps quiet'>description</th>
  8204. </thead>
  8205. <tr>
  8206. <td class='col-3 strong'><code>callback</code></td>
  8207. <td class='col-3 quiet'>
  8208. <a href="#childiterator">childIterator</a>
  8209. </td>
  8210. <td class='col-6'>Iterator receives each node and index.
  8211. </td>
  8212. </tr>
  8213. </table>
  8214. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8215. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  8216. :
  8217. <span class='force-inline'>Returns
  8218. <code>false</code>
  8219. if iteration was broke.
  8220. </span>
  8221. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8222. <pre class='p1 overflow-auto round fill-light'><code>root.walk(<span class="hljs-function"><span class="hljs-params">node</span> =&gt;</span> {
  8223. <span class="hljs-comment">// Traverses all descendant nodes.</span>
  8224. })</code></pre>
  8225. </section>
  8226. <section id='rootwalkatrules'class='mt2 mb2 px3 py1 keyline-top'>
  8227. <div class='right py2'>
  8228. <span class="px2"></span>
  8229. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L255-L276'>
  8230. <span>lib/container.js</span>
  8231. </a>
  8232. </div>
  8233. <h3 class='regular'>
  8234. <a class='black' href='#rootwalkatrules'>
  8235. <code>
  8236. walkAtRules
  8237. <span class='gray'>(name?, callback)</span>
  8238. </code>
  8239. </a>
  8240. </h3>
  8241. <p>Traverses the container’s descendant nodes, calling callback
  8242. for each at-rule node.</p>
  8243. <p>If you pass a filter, iteration will only happen over at-rules
  8244. that have matching names.</p>
  8245. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  8246. to use if you are mutating arrays during iteration.</p>
  8247. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8248. <thead class='fill-light'>
  8249. <th class='col-3 small caps quiet'>parameter</th>
  8250. <th class='col-3 small caps quiet'>type</th>
  8251. <th class='col-6 small caps quiet'>description</th>
  8252. </thead>
  8253. <tr>
  8254. <td class='col-3 strong'><code>name</code></td>
  8255. <td class='col-3 quiet'>
  8256. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  8257. </td>
  8258. <td class='col-6'>String or regular expression
  8259. to filter at-rules by name.
  8260. </td>
  8261. </tr>
  8262. <tr>
  8263. <td class='col-3 strong'><code>callback</code></td>
  8264. <td class='col-3 quiet'>
  8265. <a href="#childiterator">childIterator</a>
  8266. </td>
  8267. <td class='col-6'>Iterator receives each node and index.
  8268. </td>
  8269. </tr>
  8270. </table>
  8271. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8272. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  8273. :
  8274. <span class='force-inline'>Returns
  8275. <code>false</code>
  8276. if iteration was broke.
  8277. </span>
  8278. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8279. <pre class='p1 overflow-auto round fill-light'><code>root.walkAtRules(<span class="hljs-function"><span class="hljs-params">rule</span> =&gt;</span> {
  8280. <span class="hljs-keyword">if</span> (isOld(rule.name)) rule.remove()
  8281. })
  8282. <span class="hljs-keyword">let</span> first = <span class="hljs-literal">false</span>
  8283. root.walkAtRules(<span class="hljs-string">'charset'</span>, rule =&gt; {
  8284. <span class="hljs-keyword">if</span> (!first) {
  8285. first = <span class="hljs-literal">true</span>
  8286. } <span class="hljs-keyword">else</span> {
  8287. rule.remove()
  8288. }
  8289. })</code></pre>
  8290. </section>
  8291. <section id='rootwalkcomments'class='mt2 mb2 px3 py1 keyline-top'>
  8292. <div class='right py2'>
  8293. <span class="px2"></span>
  8294. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L294-L300'>
  8295. <span>lib/container.js</span>
  8296. </a>
  8297. </div>
  8298. <h3 class='regular'>
  8299. <a class='black' href='#rootwalkcomments'>
  8300. <code>
  8301. walkComments
  8302. <span class='gray'>(callback)</span>
  8303. </code>
  8304. </a>
  8305. </h3>
  8306. <p>Traverses the container’s descendant nodes, calling callback
  8307. for each comment node.</p>
  8308. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  8309. to use if you are mutating arrays during iteration.</p>
  8310. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8311. <thead class='fill-light'>
  8312. <th class='col-3 small caps quiet'>parameter</th>
  8313. <th class='col-3 small caps quiet'>type</th>
  8314. <th class='col-6 small caps quiet'>description</th>
  8315. </thead>
  8316. <tr>
  8317. <td class='col-3 strong'><code>callback</code></td>
  8318. <td class='col-3 quiet'>
  8319. <a href="#childiterator">childIterator</a>
  8320. </td>
  8321. <td class='col-6'>Iterator receives each node and index.
  8322. </td>
  8323. </tr>
  8324. </table>
  8325. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8326. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  8327. :
  8328. <span class='force-inline'>Returns
  8329. <code>false</code>
  8330. if iteration was broke.
  8331. </span>
  8332. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8333. <pre class='p1 overflow-auto round fill-light'><code>root.walkComments(<span class="hljs-function"><span class="hljs-params">comment</span> =&gt;</span> {
  8334. comment.remove()
  8335. })</code></pre>
  8336. </section>
  8337. <section id='rootwalkdecls'class='mt2 mb2 px3 py1 keyline-top'>
  8338. <div class='right py2'>
  8339. <span class="px2"></span>
  8340. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L155-L176'>
  8341. <span>lib/container.js</span>
  8342. </a>
  8343. </div>
  8344. <h3 class='regular'>
  8345. <a class='black' href='#rootwalkdecls'>
  8346. <code>
  8347. walkDecls
  8348. <span class='gray'>(prop?, callback)</span>
  8349. </code>
  8350. </a>
  8351. </h3>
  8352. <p>Traverses the container’s descendant nodes, calling callback
  8353. for each declaration node.</p>
  8354. <p>If you pass a filter, iteration will only happen over declarations
  8355. with matching properties.</p>
  8356. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  8357. to use if you are mutating arrays during iteration.</p>
  8358. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8359. <thead class='fill-light'>
  8360. <th class='col-3 small caps quiet'>parameter</th>
  8361. <th class='col-3 small caps quiet'>type</th>
  8362. <th class='col-6 small caps quiet'>description</th>
  8363. </thead>
  8364. <tr>
  8365. <td class='col-3 strong'><code>prop</code></td>
  8366. <td class='col-3 quiet'>
  8367. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  8368. </td>
  8369. <td class='col-6'>String or regular expression
  8370. to filter declarations by property name.
  8371. </td>
  8372. </tr>
  8373. <tr>
  8374. <td class='col-3 strong'><code>callback</code></td>
  8375. <td class='col-3 quiet'>
  8376. <a href="#childiterator">childIterator</a>
  8377. </td>
  8378. <td class='col-6'>Iterator receives each node and index.
  8379. </td>
  8380. </tr>
  8381. </table>
  8382. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8383. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  8384. :
  8385. <span class='force-inline'>Returns
  8386. <code>false</code>
  8387. if iteration was broke.
  8388. </span>
  8389. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8390. <pre class='p1 overflow-auto round fill-light'><code>root.walkDecls(<span class="hljs-function"><span class="hljs-params">decl</span> =&gt;</span> {
  8391. checkPropertySupport(decl.prop)
  8392. })
  8393. root.walkDecls(<span class="hljs-string">'border-radius'</span>, decl =&gt; {
  8394. decl.remove()
  8395. })
  8396. root.walkDecls(<span class="hljs-regexp">/^background/</span>, decl =&gt; {
  8397. decl.value = takeFirstColorFromGradient(decl.value)
  8398. })</code></pre>
  8399. </section>
  8400. <section id='rootwalkrules'class='mt2 mb2 px3 py1 keyline-top'>
  8401. <div class='right py2'>
  8402. <span class="px2"></span>
  8403. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L201-L223'>
  8404. <span>lib/container.js</span>
  8405. </a>
  8406. </div>
  8407. <h3 class='regular'>
  8408. <a class='black' href='#rootwalkrules'>
  8409. <code>
  8410. walkRules
  8411. <span class='gray'>(selector?, callback)</span>
  8412. </code>
  8413. </a>
  8414. </h3>
  8415. <p>Traverses the container’s descendant nodes, calling callback
  8416. for each rule node.</p>
  8417. <p>If you pass a filter, iteration will only happen over rules
  8418. with matching selectors.</p>
  8419. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  8420. to use if you are mutating arrays during iteration.</p>
  8421. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8422. <thead class='fill-light'>
  8423. <th class='col-3 small caps quiet'>parameter</th>
  8424. <th class='col-3 small caps quiet'>type</th>
  8425. <th class='col-6 small caps quiet'>description</th>
  8426. </thead>
  8427. <tr>
  8428. <td class='col-3 strong'><code>selector</code></td>
  8429. <td class='col-3 quiet'>
  8430. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  8431. </td>
  8432. <td class='col-6'>String or regular expression
  8433. to filter rules by selector.
  8434. </td>
  8435. </tr>
  8436. <tr>
  8437. <td class='col-3 strong'><code>callback</code></td>
  8438. <td class='col-3 quiet'>
  8439. <a href="#childiterator">childIterator</a>
  8440. </td>
  8441. <td class='col-6'>Iterator receives each node and index.
  8442. </td>
  8443. </tr>
  8444. </table>
  8445. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8446. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  8447. :
  8448. <span class='force-inline'>returns
  8449. <code>false</code>
  8450. if iteration was broke.
  8451. </span>
  8452. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8453. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> selectors = []
  8454. root.walkRules(<span class="hljs-function"><span class="hljs-params">rule</span> =&gt;</span> {
  8455. selectors.push(rule.selector)
  8456. })
  8457. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Your CSS uses <span class="hljs-subst">${ selectors.length }</span> selectors`</span>)</code></pre>
  8458. </section>
  8459. </div>
  8460. </section>
  8461. <section id='rule'class='mt2 mb2 px3 py1 keyline-top'>
  8462. <div class='right py2'>
  8463. <span class='font-smaller'>
  8464. Extends
  8465. <a href="#container">Container</a>
  8466. </span>
  8467. <span class="px2"></span>
  8468. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/rule.js#L15-L87'>
  8469. <span>lib/rule.js</span>
  8470. </a>
  8471. </div>
  8472. <h3 class='regular'>
  8473. <a class='black' href='#rule'>
  8474. <code>
  8475. Rule
  8476. <span class='gray'>(defaults)</span>
  8477. </code>
  8478. </a>
  8479. </h3>
  8480. <p>Represents a CSS rule: a selector followed by a declaration block.</p>
  8481. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8482. <thead class='fill-light'>
  8483. <th class='col-3 small caps quiet'>parameter</th>
  8484. <th class='col-3 small caps quiet'>type</th>
  8485. <th class='col-6 small caps quiet'>description</th>
  8486. </thead>
  8487. <tr>
  8488. <td class='col-3 strong'><code>defaults</code></td>
  8489. <td class='col-3 quiet'>
  8490. any
  8491. </td>
  8492. <td class='col-6'></td>
  8493. </tr>
  8494. </table>
  8495. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8496. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a{}'</span>)
  8497. <span class="hljs-keyword">const</span> rule = root.first
  8498. rule.type <span class="hljs-comment">//=&gt; 'rule'</span>
  8499. rule.toString() <span class="hljs-comment">//=&gt; 'a{}'</span></code></pre>
  8500. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  8501. <div class="section-indent">
  8502. <section id='ruleappend'class='mt2 mb2 px3 py1 keyline-top'>
  8503. <div class='right py2'>
  8504. <span class="px2"></span>
  8505. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L322-L331'>
  8506. <span>lib/container.js</span>
  8507. </a>
  8508. </div>
  8509. <h3 class='regular'>
  8510. <a class='black' href='#ruleappend'>
  8511. <code>
  8512. append
  8513. <span class='gray'>(children)</span>
  8514. </code>
  8515. </a>
  8516. </h3>
  8517. <p>Inserts new nodes to the end of the container.</p>
  8518. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8519. <thead class='fill-light'>
  8520. <th class='col-3 small caps quiet'>parameter</th>
  8521. <th class='col-3 small caps quiet'>type</th>
  8522. <th class='col-6 small caps quiet'>description</th>
  8523. </thead>
  8524. <tr>
  8525. <td class='col-3 strong'><code>children</code></td>
  8526. <td class='col-3 quiet'>
  8527. ...(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  8528. </td>
  8529. <td class='col-6'>New nodes.
  8530. </td>
  8531. </tr>
  8532. </table>
  8533. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8534. <code><a href="#node">Node</a></code>
  8535. :
  8536. <span class='force-inline'>This node for methods chain.
  8537. </span>
  8538. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8539. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> decl1 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  8540. <span class="hljs-keyword">const</span> decl2 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'background-color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'white'</span> })
  8541. rule.append(decl1, decl2)
  8542. root.append({ <span class="hljs-attr">name</span>: <span class="hljs-string">'charset'</span>, <span class="hljs-attr">params</span>: <span class="hljs-string">'"UTF-8"'</span> }) <span class="hljs-comment">// at-rule</span>
  8543. root.append({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }) <span class="hljs-comment">// rule</span>
  8544. rule.append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> }) <span class="hljs-comment">// declaration</span>
  8545. rule.append({ <span class="hljs-attr">text</span>: <span class="hljs-string">'Comment'</span> }) <span class="hljs-comment">// comment</span>
  8546. root.append(<span class="hljs-string">'a {}'</span>)
  8547. root.first.append(<span class="hljs-string">'color: black; z-index: 1'</span>)</code></pre>
  8548. </section>
  8549. <section id='ruleeach'class='mt2 mb2 px3 py1 keyline-top'>
  8550. <div class='right py2'>
  8551. <span class="px2"></span>
  8552. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L63-L89'>
  8553. <span>lib/container.js</span>
  8554. </a>
  8555. </div>
  8556. <h3 class='regular'>
  8557. <a class='black' href='#ruleeach'>
  8558. <code>
  8559. each
  8560. <span class='gray'>(callback)</span>
  8561. </code>
  8562. </a>
  8563. </h3>
  8564. <p>Iterates through the container’s immediate children,
  8565. calling <code>callback</code> for each child.</p>
  8566. <p>Returning <code>false</code> in the callback will break iteration.</p>
  8567. <p>This method only iterates through the container’s immediate children.
  8568. If you need to recursively iterate through all the container’s descendant
  8569. nodes, use <a href="#containerwalk">Container#walk</a>.</p>
  8570. <p>Unlike the for <code>{}</code>-cycle or <code>Array#forEach</code> this iterator is safe
  8571. if you are mutating the array of child nodes during iteration.
  8572. PostCSS will adjust the current index to match the mutations.</p>
  8573. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8574. <thead class='fill-light'>
  8575. <th class='col-3 small caps quiet'>parameter</th>
  8576. <th class='col-3 small caps quiet'>type</th>
  8577. <th class='col-6 small caps quiet'>description</th>
  8578. </thead>
  8579. <tr>
  8580. <td class='col-3 strong'><code>callback</code></td>
  8581. <td class='col-3 quiet'>
  8582. <a href="#childiterator">childIterator</a>
  8583. </td>
  8584. <td class='col-6'>Iterator receives each node and index.
  8585. </td>
  8586. </tr>
  8587. </table>
  8588. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8589. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  8590. :
  8591. <span class='force-inline'>Returns
  8592. <code>false</code>
  8593. if iteration was broke.
  8594. </span>
  8595. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8596. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a { color: black; z-index: 1 }'</span>)
  8597. <span class="hljs-keyword">const</span> rule = root.first
  8598. <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> decl <span class="hljs-keyword">of</span> rule.nodes) {
  8599. decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop })
  8600. <span class="hljs-comment">// Cycle will be infinite, because cloneBefore moves the current node</span>
  8601. <span class="hljs-comment">// to the next index</span>
  8602. }
  8603. rule.each(<span class="hljs-function"><span class="hljs-params">decl</span> =&gt;</span> {
  8604. decl.cloneBefore({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop })
  8605. <span class="hljs-comment">// Will be executed only for color and z-index</span>
  8606. })</code></pre>
  8607. </section>
  8608. <section id='ruleevery'class='mt2 mb2 px3 py1 keyline-top'>
  8609. <div class='right py2'>
  8610. <span class="px2"></span>
  8611. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L539-L541'>
  8612. <span>lib/container.js</span>
  8613. </a>
  8614. </div>
  8615. <h3 class='regular'>
  8616. <a class='black' href='#ruleevery'>
  8617. <code>
  8618. every
  8619. <span class='gray'>(condition)</span>
  8620. </code>
  8621. </a>
  8622. </h3>
  8623. <p>Returns <code>true</code> if callback returns <code>true</code>
  8624. for all of the container’s children.</p>
  8625. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8626. <thead class='fill-light'>
  8627. <th class='col-3 small caps quiet'>parameter</th>
  8628. <th class='col-3 small caps quiet'>type</th>
  8629. <th class='col-6 small caps quiet'>description</th>
  8630. </thead>
  8631. <tr>
  8632. <td class='col-3 strong'><code>condition</code></td>
  8633. <td class='col-3 quiet'>
  8634. <a href="#childcondition">childCondition</a>
  8635. </td>
  8636. <td class='col-6'>Iterator returns true or false.
  8637. </td>
  8638. </tr>
  8639. </table>
  8640. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8641. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  8642. :
  8643. <span class='force-inline'>Is every child pass condition.
  8644. </span>
  8645. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8646. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> noPrefixes = rule.every(<span class="hljs-function"><span class="hljs-params">i</span> =&gt;</span> i.prop[<span class="hljs-number">0</span>] !== <span class="hljs-string">'-'</span>)</code></pre>
  8647. </section>
  8648. <section id='rulefirst'class='mt2 mb2 px3 py1 keyline-top'>
  8649. <div class='right py2'>
  8650. <span class="px2"></span>
  8651. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L582-L585'>
  8652. <span>lib/container.js</span>
  8653. </a>
  8654. </div>
  8655. <h3 class='regular'>
  8656. <a class='black' href='#rulefirst'>
  8657. <code>
  8658. first
  8659. <span class='gray'>()</span>
  8660. </code>
  8661. </a>
  8662. </h3>
  8663. <p>The container’s first child.</p>
  8664. <p>
  8665. Type:
  8666. <a href="#node">Node</a>
  8667. </p>
  8668. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8669. <pre class='p1 overflow-auto round fill-light'><code>rule.first === rules.nodes[<span class="hljs-number">0</span>]</code></pre>
  8670. </section>
  8671. <section id='ruleindex'class='mt2 mb2 px3 py1 keyline-top'>
  8672. <div class='right py2'>
  8673. <span class="px2"></span>
  8674. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L568-L572'>
  8675. <span>lib/container.js</span>
  8676. </a>
  8677. </div>
  8678. <h3 class='regular'>
  8679. <a class='black' href='#ruleindex'>
  8680. <code>
  8681. index
  8682. <span class='gray'>(child)</span>
  8683. </code>
  8684. </a>
  8685. </h3>
  8686. <p>Returns a <code>child</code>’s index within the <a href="Container#nodes">Container#nodes</a> array.</p>
  8687. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8688. <thead class='fill-light'>
  8689. <th class='col-3 small caps quiet'>parameter</th>
  8690. <th class='col-3 small caps quiet'>type</th>
  8691. <th class='col-6 small caps quiet'>description</th>
  8692. </thead>
  8693. <tr>
  8694. <td class='col-3 strong'><code>child</code></td>
  8695. <td class='col-3 quiet'>
  8696. <a href="#node">Node</a>
  8697. </td>
  8698. <td class='col-6'>Child of the current container.
  8699. </td>
  8700. </tr>
  8701. </table>
  8702. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8703. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
  8704. :
  8705. <span class='force-inline'>Child index.
  8706. </span>
  8707. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8708. <pre class='p1 overflow-auto round fill-light'><code>rule.index( rule.nodes[<span class="hljs-number">2</span>] ) <span class="hljs-comment">//=&gt; 2</span></code></pre>
  8709. </section>
  8710. <section id='ruleinsertafter'class='mt2 mb2 px3 py1 keyline-top'>
  8711. <div class='right py2'>
  8712. <span class="px2"></span>
  8713. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L414-L431'>
  8714. <span>lib/container.js</span>
  8715. </a>
  8716. </div>
  8717. <h3 class='regular'>
  8718. <a class='black' href='#ruleinsertafter'>
  8719. <code>
  8720. insertAfter
  8721. <span class='gray'>(exist, add)</span>
  8722. </code>
  8723. </a>
  8724. </h3>
  8725. <p>Insert new node after old node within the container.</p>
  8726. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8727. <thead class='fill-light'>
  8728. <th class='col-3 small caps quiet'>parameter</th>
  8729. <th class='col-3 small caps quiet'>type</th>
  8730. <th class='col-6 small caps quiet'>description</th>
  8731. </thead>
  8732. <tr>
  8733. <td class='col-3 strong'><code>exist</code></td>
  8734. <td class='col-3 quiet'>
  8735. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  8736. </td>
  8737. <td class='col-6'>Child or child’s index.
  8738. </td>
  8739. </tr>
  8740. <tr>
  8741. <td class='col-3 strong'><code>add</code></td>
  8742. <td class='col-3 quiet'>
  8743. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  8744. </td>
  8745. <td class='col-6'>New node.
  8746. </td>
  8747. </tr>
  8748. </table>
  8749. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8750. <code><a href="#node">Node</a></code>
  8751. :
  8752. <span class='force-inline'>This node for methods chain.
  8753. </span>
  8754. </section>
  8755. <section id='ruleinsertbefore'class='mt2 mb2 px3 py1 keyline-top'>
  8756. <div class='right py2'>
  8757. <span class="px2"></span>
  8758. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L386-L404'>
  8759. <span>lib/container.js</span>
  8760. </a>
  8761. </div>
  8762. <h3 class='regular'>
  8763. <a class='black' href='#ruleinsertbefore'>
  8764. <code>
  8765. insertBefore
  8766. <span class='gray'>(exist, add)</span>
  8767. </code>
  8768. </a>
  8769. </h3>
  8770. <p>Insert new node before old node within the container.</p>
  8771. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8772. <thead class='fill-light'>
  8773. <th class='col-3 small caps quiet'>parameter</th>
  8774. <th class='col-3 small caps quiet'>type</th>
  8775. <th class='col-6 small caps quiet'>description</th>
  8776. </thead>
  8777. <tr>
  8778. <td class='col-3 strong'><code>exist</code></td>
  8779. <td class='col-3 quiet'>
  8780. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  8781. </td>
  8782. <td class='col-6'>Child or child’s index.
  8783. </td>
  8784. </tr>
  8785. <tr>
  8786. <td class='col-3 strong'><code>add</code></td>
  8787. <td class='col-3 quiet'>
  8788. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  8789. </td>
  8790. <td class='col-6'>New node.
  8791. </td>
  8792. </tr>
  8793. </table>
  8794. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8795. <code><a href="#node">Node</a></code>
  8796. :
  8797. <span class='force-inline'>This node for methods chain.
  8798. </span>
  8799. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8800. <pre class='p1 overflow-auto round fill-light'><code>rule.insertBefore(decl, decl.clone({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'-webkit-'</span> + decl.prop }))</code></pre>
  8801. </section>
  8802. <section id='rulelast'class='mt2 mb2 px3 py1 keyline-top'>
  8803. <div class='right py2'>
  8804. <span class="px2"></span>
  8805. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L595-L598'>
  8806. <span>lib/container.js</span>
  8807. </a>
  8808. </div>
  8809. <h3 class='regular'>
  8810. <a class='black' href='#rulelast'>
  8811. <code>
  8812. last
  8813. <span class='gray'>()</span>
  8814. </code>
  8815. </a>
  8816. </h3>
  8817. <p>The container’s last child.</p>
  8818. <p>
  8819. Type:
  8820. <a href="#node">Node</a>
  8821. </p>
  8822. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8823. <pre class='p1 overflow-auto round fill-light'><code>rule.last === rule.nodes[rule.nodes.length - <span class="hljs-number">1</span>]</code></pre>
  8824. </section>
  8825. <section id='ruleprepend'class='mt2 mb2 px3 py1 keyline-top'>
  8826. <div class='right py2'>
  8827. <span class="px2"></span>
  8828. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L353-L366'>
  8829. <span>lib/container.js</span>
  8830. </a>
  8831. </div>
  8832. <h3 class='regular'>
  8833. <a class='black' href='#ruleprepend'>
  8834. <code>
  8835. prepend
  8836. <span class='gray'>(children)</span>
  8837. </code>
  8838. </a>
  8839. </h3>
  8840. <p>Inserts new nodes to the start of the container.</p>
  8841. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8842. <thead class='fill-light'>
  8843. <th class='col-3 small caps quiet'>parameter</th>
  8844. <th class='col-3 small caps quiet'>type</th>
  8845. <th class='col-6 small caps quiet'>description</th>
  8846. </thead>
  8847. <tr>
  8848. <td class='col-3 strong'><code>children</code></td>
  8849. <td class='col-3 quiet'>
  8850. ...(<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>)
  8851. </td>
  8852. <td class='col-6'>New nodes.
  8853. </td>
  8854. </tr>
  8855. </table>
  8856. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8857. <code><a href="#node">Node</a></code>
  8858. :
  8859. <span class='force-inline'>This node for methods chain.
  8860. </span>
  8861. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8862. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> decl1 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> })
  8863. <span class="hljs-keyword">const</span> decl2 = postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'background-color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'white'</span> })
  8864. rule.prepend(decl1, decl2)
  8865. root.append({ <span class="hljs-attr">name</span>: <span class="hljs-string">'charset'</span>, <span class="hljs-attr">params</span>: <span class="hljs-string">'"UTF-8"'</span> }) <span class="hljs-comment">// at-rule</span>
  8866. root.append({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }) <span class="hljs-comment">// rule</span>
  8867. rule.append({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'black'</span> }) <span class="hljs-comment">// declaration</span>
  8868. rule.append({ <span class="hljs-attr">text</span>: <span class="hljs-string">'Comment'</span> }) <span class="hljs-comment">// comment</span>
  8869. root.append(<span class="hljs-string">'a {}'</span>)
  8870. root.first.append(<span class="hljs-string">'color: black; z-index: 1'</span>)</code></pre>
  8871. </section>
  8872. <section id='ruleremoveall'class='mt2 mb2 px3 py1 keyline-top'>
  8873. <div class='right py2'>
  8874. <span class="px2"></span>
  8875. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L475-L482'>
  8876. <span>lib/container.js</span>
  8877. </a>
  8878. </div>
  8879. <h3 class='regular'>
  8880. <a class='black' href='#ruleremoveall'>
  8881. <code>
  8882. removeAll
  8883. <span class='gray'>()</span>
  8884. </code>
  8885. </a>
  8886. </h3>
  8887. <p>Removes all children from the container
  8888. and cleans their parent properties.</p>
  8889. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8890. <code><a href="#node">Node</a></code>
  8891. :
  8892. <span class='force-inline'>This node for methods chain.
  8893. </span>
  8894. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8895. <pre class='p1 overflow-auto round fill-light'><code>rule.removeAll()
  8896. rule.nodes.length <span class="hljs-comment">//=&gt; 0</span></code></pre>
  8897. </section>
  8898. <section id='ruleremovechild'class='mt2 mb2 px3 py1 keyline-top'>
  8899. <div class='right py2'>
  8900. <span class="px2"></span>
  8901. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L447-L463'>
  8902. <span>lib/container.js</span>
  8903. </a>
  8904. </div>
  8905. <h3 class='regular'>
  8906. <a class='black' href='#ruleremovechild'>
  8907. <code>
  8908. removeChild
  8909. <span class='gray'>(child)</span>
  8910. </code>
  8911. </a>
  8912. </h3>
  8913. <p>Removes node from the container and cleans the parent properties
  8914. from the node and its children.</p>
  8915. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8916. <thead class='fill-light'>
  8917. <th class='col-3 small caps quiet'>parameter</th>
  8918. <th class='col-3 small caps quiet'>type</th>
  8919. <th class='col-6 small caps quiet'>description</th>
  8920. </thead>
  8921. <tr>
  8922. <td class='col-3 strong'><code>child</code></td>
  8923. <td class='col-3 quiet'>
  8924. (<a href="#node">Node</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)
  8925. </td>
  8926. <td class='col-6'>Child or child’s index.
  8927. </td>
  8928. </tr>
  8929. </table>
  8930. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  8931. <code><a href="#node">Node</a></code>
  8932. :
  8933. <span class='force-inline'>This node for methods chain
  8934. </span>
  8935. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  8936. <pre class='p1 overflow-auto round fill-light'><code>rule.nodes.length <span class="hljs-comment">//=&gt; 5</span>
  8937. rule.removeChild(decl)
  8938. rule.nodes.length <span class="hljs-comment">//=&gt; 4</span>
  8939. decl.parent <span class="hljs-comment">//=&gt; undefined</span></code></pre>
  8940. </section>
  8941. <section id='rulereplacevalues'class='mt2 mb2 px3 py1 keyline-top'>
  8942. <div class='right py2'>
  8943. <span class="px2"></span>
  8944. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L510-L526'>
  8945. <span>lib/container.js</span>
  8946. </a>
  8947. </div>
  8948. <h3 class='regular'>
  8949. <a class='black' href='#rulereplacevalues'>
  8950. <code>
  8951. replaceValues
  8952. <span class='gray'>(pattern, opts, callback)</span>
  8953. </code>
  8954. </a>
  8955. </h3>
  8956. <p>Passes all declaration values within the container that match pattern
  8957. through callback, replacing those values with the returned result
  8958. of callback.</p>
  8959. <p>This method is useful if you are using a custom unit or function
  8960. and need to iterate through all values.</p>
  8961. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  8962. <thead class='fill-light'>
  8963. <th class='col-3 small caps quiet'>parameter</th>
  8964. <th class='col-3 small caps quiet'>type</th>
  8965. <th class='col-6 small caps quiet'>description</th>
  8966. </thead>
  8967. <tr>
  8968. <td class='col-3 strong'><code>pattern</code></td>
  8969. <td class='col-3 quiet'>
  8970. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)
  8971. </td>
  8972. <td class='col-6'>Replace pattern.
  8973. </td>
  8974. </tr>
  8975. <tr>
  8976. <td class='col-3 strong'><code>opts</code></td>
  8977. <td class='col-3 quiet'>
  8978. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  8979. </td>
  8980. <td class='col-6'>Options to speed up the search.
  8981. </td>
  8982. </tr>
  8983. <tr>
  8984. <td class='col-2 strong'>opts.props</td>
  8985. <td class="col-2 quiet">
  8986. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>)
  8987. </td>
  8988. <td class='col-8'>An array of property names.
  8989. </td>
  8990. </tr>
  8991. <tr>
  8992. <td class='col-2 strong'>opts.fast</td>
  8993. <td class="col-2 quiet">
  8994. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  8995. </td>
  8996. <td class='col-8'>String that’s used to narrow down
  8997. values and speed up the regexp search.
  8998. </td>
  8999. </tr>
  9000. <tr>
  9001. <td class='col-3 strong'><code>callback</code></td>
  9002. <td class='col-3 quiet'>
  9003. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)
  9004. </td>
  9005. <td class='col-6'>String to replace pattern or callback
  9006. that returns a new value. The callback
  9007. will receive the same arguments
  9008. as those passed to a function parameter
  9009. of
  9010. <code>String#replace</code>
  9011. .
  9012. </td>
  9013. </tr>
  9014. </table>
  9015. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9016. <code><a href="#node">Node</a></code>
  9017. :
  9018. <span class='force-inline'>This node for methods chain.
  9019. </span>
  9020. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9021. <pre class='p1 overflow-auto round fill-light'><code>root.replaceValues(<span class="hljs-regexp">/\d+rem/</span>, { <span class="hljs-attr">fast</span>: <span class="hljs-string">'rem'</span> }, string =&gt; {
  9022. <span class="hljs-keyword">return</span> <span class="hljs-number">15</span> * <span class="hljs-built_in">parseInt</span>(string) + <span class="hljs-string">'px'</span>
  9023. })</code></pre>
  9024. </section>
  9025. <section id='ruleselectors'class='mt2 mb2 px3 py1 keyline-top'>
  9026. <div class='right py2'>
  9027. <span class="px2"></span>
  9028. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/rule.js#L38-L40'>
  9029. <span>lib/rule.js</span>
  9030. </a>
  9031. </div>
  9032. <h3 class='regular'>
  9033. <a class='black' href='#ruleselectors'>
  9034. <code>
  9035. selectors
  9036. <span class='gray'>()</span>
  9037. </code>
  9038. </a>
  9039. </h3>
  9040. <p>An array containing the rule’s individual selectors.
  9041. Groups of selectors are split at commas.</p>
  9042. <p>
  9043. Type:
  9044. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>
  9045. </p>
  9046. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9047. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> root = postcss.parse(<span class="hljs-string">'a, b { }'</span>)
  9048. <span class="hljs-keyword">const</span> rule = root.first
  9049. rule.selector <span class="hljs-comment">//=&gt; 'a, b'</span>
  9050. rule.selectors <span class="hljs-comment">//=&gt; ['a', 'b']</span>
  9051. rule.selectors = [<span class="hljs-string">'a'</span>, <span class="hljs-string">'strong'</span>]
  9052. rule.selector <span class="hljs-comment">//=&gt; 'a, strong'</span></code></pre>
  9053. </section>
  9054. <section id='rulesome'class='mt2 mb2 px3 py1 keyline-top'>
  9055. <div class='right py2'>
  9056. <span class="px2"></span>
  9057. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L554-L556'>
  9058. <span>lib/container.js</span>
  9059. </a>
  9060. </div>
  9061. <h3 class='regular'>
  9062. <a class='black' href='#rulesome'>
  9063. <code>
  9064. some
  9065. <span class='gray'>(condition)</span>
  9066. </code>
  9067. </a>
  9068. </h3>
  9069. <p>Returns <code>true</code> if callback returns <code>true</code> for (at least) one
  9070. of the container’s children.</p>
  9071. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9072. <thead class='fill-light'>
  9073. <th class='col-3 small caps quiet'>parameter</th>
  9074. <th class='col-3 small caps quiet'>type</th>
  9075. <th class='col-6 small caps quiet'>description</th>
  9076. </thead>
  9077. <tr>
  9078. <td class='col-3 strong'><code>condition</code></td>
  9079. <td class='col-3 quiet'>
  9080. <a href="#childcondition">childCondition</a>
  9081. </td>
  9082. <td class='col-6'>Iterator returns true or false.
  9083. </td>
  9084. </tr>
  9085. </table>
  9086. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9087. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  9088. :
  9089. <span class='force-inline'>Is some child pass condition.
  9090. </span>
  9091. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9092. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> hasPrefix = rule.some(<span class="hljs-function"><span class="hljs-params">i</span> =&gt;</span> i.prop[<span class="hljs-number">0</span>] === <span class="hljs-string">'-'</span>)</code></pre>
  9093. </section>
  9094. <section id='rulewalk'class='mt2 mb2 px3 py1 keyline-top'>
  9095. <div class='right py2'>
  9096. <span class="px2"></span>
  9097. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L110-L124'>
  9098. <span>lib/container.js</span>
  9099. </a>
  9100. </div>
  9101. <h3 class='regular'>
  9102. <a class='black' href='#rulewalk'>
  9103. <code>
  9104. walk
  9105. <span class='gray'>(callback)</span>
  9106. </code>
  9107. </a>
  9108. </h3>
  9109. <p>Traverses the container’s descendant nodes, calling callback
  9110. for each node.</p>
  9111. <p>Like container.each(), this method is safe to use
  9112. if you are mutating arrays during iteration.</p>
  9113. <p>If you only need to iterate through the container’s immediate children,
  9114. use <a href="#containereach">Container#each</a>.</p>
  9115. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9116. <thead class='fill-light'>
  9117. <th class='col-3 small caps quiet'>parameter</th>
  9118. <th class='col-3 small caps quiet'>type</th>
  9119. <th class='col-6 small caps quiet'>description</th>
  9120. </thead>
  9121. <tr>
  9122. <td class='col-3 strong'><code>callback</code></td>
  9123. <td class='col-3 quiet'>
  9124. <a href="#childiterator">childIterator</a>
  9125. </td>
  9126. <td class='col-6'>Iterator receives each node and index.
  9127. </td>
  9128. </tr>
  9129. </table>
  9130. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9131. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  9132. :
  9133. <span class='force-inline'>Returns
  9134. <code>false</code>
  9135. if iteration was broke.
  9136. </span>
  9137. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9138. <pre class='p1 overflow-auto round fill-light'><code>root.walk(<span class="hljs-function"><span class="hljs-params">node</span> =&gt;</span> {
  9139. <span class="hljs-comment">// Traverses all descendant nodes.</span>
  9140. })</code></pre>
  9141. </section>
  9142. <section id='rulewalkatrules'class='mt2 mb2 px3 py1 keyline-top'>
  9143. <div class='right py2'>
  9144. <span class="px2"></span>
  9145. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L255-L276'>
  9146. <span>lib/container.js</span>
  9147. </a>
  9148. </div>
  9149. <h3 class='regular'>
  9150. <a class='black' href='#rulewalkatrules'>
  9151. <code>
  9152. walkAtRules
  9153. <span class='gray'>(name?, callback)</span>
  9154. </code>
  9155. </a>
  9156. </h3>
  9157. <p>Traverses the container’s descendant nodes, calling callback
  9158. for each at-rule node.</p>
  9159. <p>If you pass a filter, iteration will only happen over at-rules
  9160. that have matching names.</p>
  9161. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  9162. to use if you are mutating arrays during iteration.</p>
  9163. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9164. <thead class='fill-light'>
  9165. <th class='col-3 small caps quiet'>parameter</th>
  9166. <th class='col-3 small caps quiet'>type</th>
  9167. <th class='col-6 small caps quiet'>description</th>
  9168. </thead>
  9169. <tr>
  9170. <td class='col-3 strong'><code>name</code></td>
  9171. <td class='col-3 quiet'>
  9172. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  9173. </td>
  9174. <td class='col-6'>String or regular expression
  9175. to filter at-rules by name.
  9176. </td>
  9177. </tr>
  9178. <tr>
  9179. <td class='col-3 strong'><code>callback</code></td>
  9180. <td class='col-3 quiet'>
  9181. <a href="#childiterator">childIterator</a>
  9182. </td>
  9183. <td class='col-6'>Iterator receives each node and index.
  9184. </td>
  9185. </tr>
  9186. </table>
  9187. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9188. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  9189. :
  9190. <span class='force-inline'>Returns
  9191. <code>false</code>
  9192. if iteration was broke.
  9193. </span>
  9194. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9195. <pre class='p1 overflow-auto round fill-light'><code>root.walkAtRules(<span class="hljs-function"><span class="hljs-params">rule</span> =&gt;</span> {
  9196. <span class="hljs-keyword">if</span> (isOld(rule.name)) rule.remove()
  9197. })
  9198. <span class="hljs-keyword">let</span> first = <span class="hljs-literal">false</span>
  9199. root.walkAtRules(<span class="hljs-string">'charset'</span>, rule =&gt; {
  9200. <span class="hljs-keyword">if</span> (!first) {
  9201. first = <span class="hljs-literal">true</span>
  9202. } <span class="hljs-keyword">else</span> {
  9203. rule.remove()
  9204. }
  9205. })</code></pre>
  9206. </section>
  9207. <section id='rulewalkcomments'class='mt2 mb2 px3 py1 keyline-top'>
  9208. <div class='right py2'>
  9209. <span class="px2"></span>
  9210. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L294-L300'>
  9211. <span>lib/container.js</span>
  9212. </a>
  9213. </div>
  9214. <h3 class='regular'>
  9215. <a class='black' href='#rulewalkcomments'>
  9216. <code>
  9217. walkComments
  9218. <span class='gray'>(callback)</span>
  9219. </code>
  9220. </a>
  9221. </h3>
  9222. <p>Traverses the container’s descendant nodes, calling callback
  9223. for each comment node.</p>
  9224. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  9225. to use if you are mutating arrays during iteration.</p>
  9226. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9227. <thead class='fill-light'>
  9228. <th class='col-3 small caps quiet'>parameter</th>
  9229. <th class='col-3 small caps quiet'>type</th>
  9230. <th class='col-6 small caps quiet'>description</th>
  9231. </thead>
  9232. <tr>
  9233. <td class='col-3 strong'><code>callback</code></td>
  9234. <td class='col-3 quiet'>
  9235. <a href="#childiterator">childIterator</a>
  9236. </td>
  9237. <td class='col-6'>Iterator receives each node and index.
  9238. </td>
  9239. </tr>
  9240. </table>
  9241. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9242. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  9243. :
  9244. <span class='force-inline'>Returns
  9245. <code>false</code>
  9246. if iteration was broke.
  9247. </span>
  9248. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9249. <pre class='p1 overflow-auto round fill-light'><code>root.walkComments(<span class="hljs-function"><span class="hljs-params">comment</span> =&gt;</span> {
  9250. comment.remove()
  9251. })</code></pre>
  9252. </section>
  9253. <section id='rulewalkdecls'class='mt2 mb2 px3 py1 keyline-top'>
  9254. <div class='right py2'>
  9255. <span class="px2"></span>
  9256. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L155-L176'>
  9257. <span>lib/container.js</span>
  9258. </a>
  9259. </div>
  9260. <h3 class='regular'>
  9261. <a class='black' href='#rulewalkdecls'>
  9262. <code>
  9263. walkDecls
  9264. <span class='gray'>(prop?, callback)</span>
  9265. </code>
  9266. </a>
  9267. </h3>
  9268. <p>Traverses the container’s descendant nodes, calling callback
  9269. for each declaration node.</p>
  9270. <p>If you pass a filter, iteration will only happen over declarations
  9271. with matching properties.</p>
  9272. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  9273. to use if you are mutating arrays during iteration.</p>
  9274. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9275. <thead class='fill-light'>
  9276. <th class='col-3 small caps quiet'>parameter</th>
  9277. <th class='col-3 small caps quiet'>type</th>
  9278. <th class='col-6 small caps quiet'>description</th>
  9279. </thead>
  9280. <tr>
  9281. <td class='col-3 strong'><code>prop</code></td>
  9282. <td class='col-3 quiet'>
  9283. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  9284. </td>
  9285. <td class='col-6'>String or regular expression
  9286. to filter declarations by property name.
  9287. </td>
  9288. </tr>
  9289. <tr>
  9290. <td class='col-3 strong'><code>callback</code></td>
  9291. <td class='col-3 quiet'>
  9292. <a href="#childiterator">childIterator</a>
  9293. </td>
  9294. <td class='col-6'>Iterator receives each node and index.
  9295. </td>
  9296. </tr>
  9297. </table>
  9298. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9299. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  9300. :
  9301. <span class='force-inline'>Returns
  9302. <code>false</code>
  9303. if iteration was broke.
  9304. </span>
  9305. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9306. <pre class='p1 overflow-auto round fill-light'><code>root.walkDecls(<span class="hljs-function"><span class="hljs-params">decl</span> =&gt;</span> {
  9307. checkPropertySupport(decl.prop)
  9308. })
  9309. root.walkDecls(<span class="hljs-string">'border-radius'</span>, decl =&gt; {
  9310. decl.remove()
  9311. })
  9312. root.walkDecls(<span class="hljs-regexp">/^background/</span>, decl =&gt; {
  9313. decl.value = takeFirstColorFromGradient(decl.value)
  9314. })</code></pre>
  9315. </section>
  9316. <section id='rulewalkrules'class='mt2 mb2 px3 py1 keyline-top'>
  9317. <div class='right py2'>
  9318. <span class="px2"></span>
  9319. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L201-L223'>
  9320. <span>lib/container.js</span>
  9321. </a>
  9322. </div>
  9323. <h3 class='regular'>
  9324. <a class='black' href='#rulewalkrules'>
  9325. <code>
  9326. walkRules
  9327. <span class='gray'>(selector?, callback)</span>
  9328. </code>
  9329. </a>
  9330. </h3>
  9331. <p>Traverses the container’s descendant nodes, calling callback
  9332. for each rule node.</p>
  9333. <p>If you pass a filter, iteration will only happen over rules
  9334. with matching selectors.</p>
  9335. <p>Like <a href="#containereach">Container#each</a>, this method is safe
  9336. to use if you are mutating arrays during iteration.</p>
  9337. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9338. <thead class='fill-light'>
  9339. <th class='col-3 small caps quiet'>parameter</th>
  9340. <th class='col-3 small caps quiet'>type</th>
  9341. <th class='col-6 small caps quiet'>description</th>
  9342. </thead>
  9343. <tr>
  9344. <td class='col-3 strong'><code>selector</code></td>
  9345. <td class='col-3 quiet'>
  9346. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>)?
  9347. </td>
  9348. <td class='col-6'>String or regular expression
  9349. to filter rules by selector.
  9350. </td>
  9351. </tr>
  9352. <tr>
  9353. <td class='col-3 strong'><code>callback</code></td>
  9354. <td class='col-3 quiet'>
  9355. <a href="#childiterator">childIterator</a>
  9356. </td>
  9357. <td class='col-6'>Iterator receives each node and index.
  9358. </td>
  9359. </tr>
  9360. </table>
  9361. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9362. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  9363. :
  9364. <span class='force-inline'>returns
  9365. <code>false</code>
  9366. if iteration was broke.
  9367. </span>
  9368. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9369. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> selectors = []
  9370. root.walkRules(<span class="hljs-function"><span class="hljs-params">rule</span> =&gt;</span> {
  9371. selectors.push(rule.selector)
  9372. })
  9373. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Your CSS uses <span class="hljs-subst">${ selectors.length }</span> selectors`</span>)</code></pre>
  9374. </section>
  9375. </div>
  9376. </section>
  9377. <section id='warning'class='mt2 mb2 px3 py1 keyline-top'>
  9378. <div class='right py2'>
  9379. <span class="px2"></span>
  9380. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/warning.js#L9-L107'>
  9381. <span>lib/warning.js</span>
  9382. </a>
  9383. </div>
  9384. <h3 class='regular'>
  9385. <a class='black' href='#warning'>
  9386. <code>
  9387. Warning
  9388. <span class='gray'>(text, opts = {})</span>
  9389. </code>
  9390. </a>
  9391. </h3>
  9392. <p>Represents a plugin’s warning. It can be created using <a href="#nodewarn">Node#warn</a>.</p>
  9393. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9394. <thead class='fill-light'>
  9395. <th class='col-3 small caps quiet'>parameter</th>
  9396. <th class='col-3 small caps quiet'>type</th>
  9397. <th class='col-6 small caps quiet'>description</th>
  9398. </thead>
  9399. <tr>
  9400. <td class='col-3 strong'><code>text</code></td>
  9401. <td class='col-3 quiet'>
  9402. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  9403. </td>
  9404. <td class='col-6'>Warning message.
  9405. </td>
  9406. </tr>
  9407. <tr>
  9408. <td class='col-3 strong'><code>opts</code></td>
  9409. <td class='col-3 quiet'>
  9410. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>?
  9411. = <code>{}</code>
  9412. </td>
  9413. <td class='col-6'>Warning options.
  9414. </td>
  9415. </tr>
  9416. </table>
  9417. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9418. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">if</span> (decl.important) {
  9419. decl.warn(result, <span class="hljs-string">'Avoid !important'</span>, { <span class="hljs-attr">word</span>: <span class="hljs-string">'!important'</span> })
  9420. }</code></pre>
  9421. <h4 class='caps quiet mb2 mt3'>Instance Members</h4>
  9422. <div class="section-indent">
  9423. <section id='warningtype'class='mt2 mb2 px3 py1 keyline-top'>
  9424. <div class='right py2'>
  9425. <span class="px2"></span>
  9426. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/warning.js#L31-L31'>
  9427. <span>lib/warning.js</span>
  9428. </a>
  9429. </div>
  9430. <h3 class='regular'>
  9431. <a class='black' href='#warningtype'>
  9432. <code>
  9433. type
  9434. <span class='gray'>()</span>
  9435. </code>
  9436. </a>
  9437. </h3>
  9438. <p>Type to filter warnings from <a href="#resultmessages">Result#messages</a>.
  9439. Always equal to <code>"warning"</code>.</p>
  9440. <p>
  9441. Type:
  9442. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  9443. </p>
  9444. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9445. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> nonWarning = result.messages.filter(<span class="hljs-function"><span class="hljs-params">i</span> =&gt;</span> i.type !== <span class="hljs-string">'warning'</span>)</code></pre>
  9446. </section>
  9447. <section id='warningtext'class='mt2 mb2 px3 py1 keyline-top'>
  9448. <div class='right py2'>
  9449. <span class="px2"></span>
  9450. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/warning.js#L40-L40'>
  9451. <span>lib/warning.js</span>
  9452. </a>
  9453. </div>
  9454. <h3 class='regular'>
  9455. <a class='black' href='#warningtext'>
  9456. <code>
  9457. text
  9458. <span class='gray'>()</span>
  9459. </code>
  9460. </a>
  9461. </h3>
  9462. <p>The warning message.</p>
  9463. <p>
  9464. Type:
  9465. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  9466. </p>
  9467. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9468. <pre class='p1 overflow-auto round fill-light'><code>warning.text <span class="hljs-comment">//=&gt; 'Try to avoid !important'</span></code></pre>
  9469. </section>
  9470. <section id='warningline'class='mt2 mb2 px3 py1 keyline-top'>
  9471. <div class='right py2'>
  9472. <span class="px2"></span>
  9473. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/warning.js#L51-L51'>
  9474. <span>lib/warning.js</span>
  9475. </a>
  9476. </div>
  9477. <h3 class='regular'>
  9478. <a class='black' href='#warningline'>
  9479. <code>
  9480. line
  9481. <span class='gray'>()</span>
  9482. </code>
  9483. </a>
  9484. </h3>
  9485. <p>Line in the input file with this warning’s source.</p>
  9486. <p>
  9487. Type:
  9488. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  9489. </p>
  9490. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9491. <pre class='p1 overflow-auto round fill-light'><code>warning.line <span class="hljs-comment">//=&gt; 5</span></code></pre>
  9492. </section>
  9493. <section id='warningcolumn'class='mt2 mb2 px3 py1 keyline-top'>
  9494. <div class='right py2'>
  9495. <span class="px2"></span>
  9496. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/warning.js#L60-L60'>
  9497. <span>lib/warning.js</span>
  9498. </a>
  9499. </div>
  9500. <h3 class='regular'>
  9501. <a class='black' href='#warningcolumn'>
  9502. <code>
  9503. column
  9504. <span class='gray'>()</span>
  9505. </code>
  9506. </a>
  9507. </h3>
  9508. <p>Column in the input file with this warning’s source.</p>
  9509. <p>
  9510. Type:
  9511. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  9512. </p>
  9513. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9514. <pre class='p1 overflow-auto round fill-light'><code>warning.column <span class="hljs-comment">//=&gt; 6</span></code></pre>
  9515. </section>
  9516. <section id='warningtostring'class='mt2 mb2 px3 py1 keyline-top'>
  9517. <div class='right py2'>
  9518. <span class="px2"></span>
  9519. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/warning.js#L74-L88'>
  9520. <span>lib/warning.js</span>
  9521. </a>
  9522. </div>
  9523. <h3 class='regular'>
  9524. <a class='black' href='#warningtostring'>
  9525. <code>
  9526. toString
  9527. <span class='gray'>()</span>
  9528. </code>
  9529. </a>
  9530. </h3>
  9531. <p>Returns a warning position and message.</p>
  9532. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9533. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  9534. :
  9535. <span class='force-inline'>Warning position and message.
  9536. </span>
  9537. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9538. <pre class='p1 overflow-auto round fill-light'><code>warning.toString() <span class="hljs-comment">//=&gt; 'postcss-lint:a.css:10:14: Avoid !important'</span></code></pre>
  9539. </section>
  9540. </div>
  9541. </section>
  9542. <div class="hide">
  9543. <section class='py2 clearfix'>
  9544. <h2 id='namespaces' class='mt0'>
  9545. NAMESPACES
  9546. </h2>
  9547. </section>
  9548. </div>
  9549. <section id='list'class='mt2 mb2 px3 py1 keyline-top'>
  9550. <div class='right py2'>
  9551. <span class="px2"></span>
  9552. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/list.js#L10-L85'>
  9553. <span>lib/list.js</span>
  9554. </a>
  9555. </div>
  9556. <h3 class='regular'>
  9557. <a class='black' href='#list'>
  9558. <code>
  9559. list
  9560. <span class='gray'>()</span>
  9561. </code>
  9562. </a>
  9563. </h3>
  9564. <p>Contains helpers for safely splitting lists of CSS values,
  9565. preserving parentheses and quotes.</p>
  9566. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9567. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> list = postcss.list</code></pre>
  9568. <h4 class='caps quiet mb2 mt3'>Static Members</h4>
  9569. <div class="section-indent">
  9570. <section id='listspace'class='mt2 mb2 px3 py1 keyline-top'>
  9571. <div class='right py2'>
  9572. <span class="px2"></span>
  9573. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/list.js#L64-L67'>
  9574. <span>lib/list.js</span>
  9575. </a>
  9576. </div>
  9577. <h3 class='regular'>
  9578. <a class='black' href='#listspace'>
  9579. <code>
  9580. space
  9581. <span class='gray'>(string)</span>
  9582. </code>
  9583. </a>
  9584. </h3>
  9585. <p>Safely splits space-separated values (such as those for <code>background</code>,
  9586. <code>border-radius</code>, and other shorthand properties).</p>
  9587. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9588. <thead class='fill-light'>
  9589. <th class='col-3 small caps quiet'>parameter</th>
  9590. <th class='col-3 small caps quiet'>type</th>
  9591. <th class='col-6 small caps quiet'>description</th>
  9592. </thead>
  9593. <tr>
  9594. <td class='col-3 strong'><code>string</code></td>
  9595. <td class='col-3 quiet'>
  9596. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  9597. </td>
  9598. <td class='col-6'>Space-separated values.
  9599. </td>
  9600. </tr>
  9601. </table>
  9602. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9603. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code>
  9604. :
  9605. <span class='force-inline'>Split values.
  9606. </span>
  9607. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9608. <pre class='p1 overflow-auto round fill-light'><code>postcss.list.space(<span class="hljs-string">'1px calc(10% + 1px)'</span>) <span class="hljs-comment">//=&gt; ['1px', 'calc(10% + 1px)']</span></code></pre>
  9609. </section>
  9610. <section id='listcomma'class='mt2 mb2 px3 py1 keyline-top'>
  9611. <div class='right py2'>
  9612. <span class="px2"></span>
  9613. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/list.js#L81-L83'>
  9614. <span>lib/list.js</span>
  9615. </a>
  9616. </div>
  9617. <h3 class='regular'>
  9618. <a class='black' href='#listcomma'>
  9619. <code>
  9620. comma
  9621. <span class='gray'>(string)</span>
  9622. </code>
  9623. </a>
  9624. </h3>
  9625. <p>Safely splits comma-separated values (such as those for <code>transition-*</code>
  9626. and <code>background</code> properties).</p>
  9627. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9628. <thead class='fill-light'>
  9629. <th class='col-3 small caps quiet'>parameter</th>
  9630. <th class='col-3 small caps quiet'>type</th>
  9631. <th class='col-6 small caps quiet'>description</th>
  9632. </thead>
  9633. <tr>
  9634. <td class='col-3 strong'><code>string</code></td>
  9635. <td class='col-3 quiet'>
  9636. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  9637. </td>
  9638. <td class='col-6'>Comma-separated values.
  9639. </td>
  9640. </tr>
  9641. </table>
  9642. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9643. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code>
  9644. :
  9645. <span class='force-inline'>Split values.
  9646. </span>
  9647. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9648. <pre class='p1 overflow-auto round fill-light'><code>postcss.list.comma(<span class="hljs-string">'black, linear-gradient(white, black)'</span>)
  9649. <span class="hljs-comment">//=&gt; ['black', 'linear-gradient(white, black)']</span></code></pre>
  9650. </section>
  9651. </div>
  9652. </section>
  9653. <section id='postcss'class='mt2 mb2 px3 py1 keyline-top'>
  9654. <div class='right py2'>
  9655. <span class="px2"></span>
  9656. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L30-L35'>
  9657. <span>lib/postcss.js</span>
  9658. </a>
  9659. </div>
  9660. <h3 class='regular'>
  9661. <a class='black' href='#postcss'>
  9662. <code>
  9663. postcss
  9664. <span class='gray'>(plugins)</span>
  9665. </code>
  9666. </a>
  9667. </h3>
  9668. <p>Create a new <a href="#processor">Processor</a> instance that will apply <code>plugins</code>
  9669. as CSS processors.</p>
  9670. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9671. <thead class='fill-light'>
  9672. <th class='col-3 small caps quiet'>parameter</th>
  9673. <th class='col-3 small caps quiet'>type</th>
  9674. <th class='col-6 small caps quiet'>description</th>
  9675. </thead>
  9676. <tr>
  9677. <td class='col-3 strong'><code>plugins</code></td>
  9678. <td class='col-3 quiet'>
  9679. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;(<a href="#plugin">Plugin</a> | <a href="#pluginfunction">pluginFunction</a>)> | <a href="#processor">Processor</a>)
  9680. </td>
  9681. <td class='col-6'>PostCSS plugins.
  9682. See
  9683. <a href="#processoruse">Processor#use</a>
  9684. for plugin format.
  9685. </td>
  9686. </tr>
  9687. </table>
  9688. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9689. <code><a href="#processor">Processor</a></code>
  9690. :
  9691. <span class='force-inline'>Processor to process multiple CSS.
  9692. </span>
  9693. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9694. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">let</span> postcss = <span class="hljs-built_in">require</span>(<span class="hljs-string">'postcss'</span>)
  9695. postcss(plugins).process(css, { <span class="hljs-keyword">from</span>, to }).then(<span class="hljs-function"><span class="hljs-params">result</span> =&gt;</span> {
  9696. <span class="hljs-built_in">console</span>.log(result.css)
  9697. })</code></pre>
  9698. <h4 class='caps quiet mb2 mt3'>Static Members</h4>
  9699. <div class="section-indent">
  9700. <section id='postcssplugin'class='mt2 mb2 px3 py1 keyline-top'>
  9701. <div class='right py2'>
  9702. <span class="px2"></span>
  9703. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L109-L130'>
  9704. <span>lib/postcss.js</span>
  9705. </a>
  9706. </div>
  9707. <h3 class='regular'>
  9708. <a class='black' href='#postcssplugin'>
  9709. <code>
  9710. plugin
  9711. <span class='gray'>(name, initializer)</span>
  9712. </code>
  9713. </a>
  9714. </h3>
  9715. <p>Creates a PostCSS plugin with a standard API.</p>
  9716. <p>The newly-wrapped function will provide both the name and PostCSS
  9717. version of the plugin.</p>
  9718. <pre class='hljs'><span class="hljs-keyword">const</span> processor = postcss([replace])
  9719. processor.plugins[<span class="hljs-number">0</span>].postcssPlugin <span class="hljs-comment">//=&gt; 'postcss-replace'</span>
  9720. processor.plugins[<span class="hljs-number">0</span>].postcssVersion <span class="hljs-comment">//=&gt; '6.0.0'</span></pre>
  9721. <p>The plugin function receives 2 arguments: <a href="#root">Root</a>
  9722. and <a href="#result">Result</a> instance. The function should mutate the provided
  9723. <code>Root</code> node. Alternatively, you can create a new <code>Root</code> node
  9724. and override the <code>result.root</code> property.</p>
  9725. <pre class='hljs'><span class="hljs-keyword">const</span> cleaner = postcss.plugin(<span class="hljs-string">'postcss-cleaner'</span>, () =&gt; {
  9726. <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">root, result</span>) =&gt;</span> {
  9727. result.root = postcss.root()
  9728. }
  9729. })</pre>
  9730. <p>As a convenience, plugins also expose a <code>process</code> method so that you can use
  9731. them as standalone tools.</p>
  9732. <pre class='hljs'>cleaner.process(css, processOpts, pluginOpts)
  9733. <span class="hljs-comment">// This is equivalent to:</span>
  9734. postcss([ cleaner(pluginOpts) ]).process(css, processOpts)</pre>
  9735. <p>Asynchronous plugins should return a <code>Promise</code> instance.</p>
  9736. <pre class='hljs'>postcss.plugin(<span class="hljs-string">'postcss-import'</span>, () =&gt; {
  9737. <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">root, result</span>) =&gt;</span> {
  9738. <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>( <span class="hljs-function">(<span class="hljs-params">resolve, reject</span>) =&gt;</span> {
  9739. fs.readFile(<span class="hljs-string">'base.css'</span>, (base) =&gt; {
  9740. root.prepend(base)
  9741. resolve()
  9742. })
  9743. })
  9744. }
  9745. })</pre>
  9746. <p>Add warnings using the <a href="#nodewarn">Node#warn</a> method.
  9747. Send data to other plugins using the <a href="#resultmessages">Result#messages</a> array.</p>
  9748. <pre class='hljs'>postcss.plugin(<span class="hljs-string">'postcss-caniuse-test'</span>, () =&gt; {
  9749. <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">root, result</span>) =&gt;</span> {
  9750. root.walkDecls(<span class="hljs-function"><span class="hljs-params">decl</span> =&gt;</span> {
  9751. <span class="hljs-keyword">if</span> (!caniuse.support(decl.prop)) {
  9752. decl.warn(result, <span class="hljs-string">'Some browsers do not support '</span> + decl.prop)
  9753. }
  9754. })
  9755. }
  9756. })</pre>
  9757. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9758. <thead class='fill-light'>
  9759. <th class='col-3 small caps quiet'>parameter</th>
  9760. <th class='col-3 small caps quiet'>type</th>
  9761. <th class='col-6 small caps quiet'>description</th>
  9762. </thead>
  9763. <tr>
  9764. <td class='col-3 strong'><code>name</code></td>
  9765. <td class='col-3 quiet'>
  9766. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  9767. </td>
  9768. <td class='col-6'>PostCSS plugin name. Same as in
  9769. <code>name</code>
  9770. property in
  9771. <code>package.json</code>
  9772. . It will be saved
  9773. in
  9774. <code>plugin.postcssPlugin</code>
  9775. property.
  9776. </td>
  9777. </tr>
  9778. <tr>
  9779. <td class='col-3 strong'><code>initializer</code></td>
  9780. <td class='col-3 quiet'>
  9781. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a>
  9782. </td>
  9783. <td class='col-6'>Will receive plugin options
  9784. and should return
  9785. <a href="#pluginfunction">pluginFunction</a>
  9786. </td>
  9787. </tr>
  9788. </table>
  9789. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9790. <code><a href="#plugin">Plugin</a></code>
  9791. :
  9792. <span class='force-inline'>PostCSS plugin.
  9793. </span>
  9794. </section>
  9795. <section id='postcssstringify'class='mt2 mb2 px3 py1 keyline-top'>
  9796. <div class='right py2'>
  9797. <span class="px2"></span>
  9798. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L143-L143'>
  9799. <span>lib/postcss.js</span>
  9800. </a>
  9801. </div>
  9802. <h3 class='regular'>
  9803. <a class='black' href='#postcssstringify'>
  9804. <code>
  9805. stringify
  9806. <span class='gray'>(node, builder)</span>
  9807. </code>
  9808. </a>
  9809. </h3>
  9810. <p>Default function to convert a node tree into a CSS string.</p>
  9811. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9812. <thead class='fill-light'>
  9813. <th class='col-3 small caps quiet'>parameter</th>
  9814. <th class='col-3 small caps quiet'>type</th>
  9815. <th class='col-6 small caps quiet'>description</th>
  9816. </thead>
  9817. <tr>
  9818. <td class='col-3 strong'><code>node</code></td>
  9819. <td class='col-3 quiet'>
  9820. <a href="#node">Node</a>
  9821. </td>
  9822. <td class='col-6'>Start node for stringifing. Usually
  9823. <a href="#root">Root</a>
  9824. .
  9825. </td>
  9826. </tr>
  9827. <tr>
  9828. <td class='col-3 strong'><code>builder</code></td>
  9829. <td class='col-3 quiet'>
  9830. <a href="#builder">builder</a>
  9831. </td>
  9832. <td class='col-6'>Function to concatenate CSS from node’s parts
  9833. or generate string and source map.
  9834. </td>
  9835. </tr>
  9836. </table>
  9837. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9838. <code>void</code>
  9839. :
  9840. <span class='force-inline'>
  9841. </span>
  9842. </section>
  9843. <section id='postcssparse'class='mt2 mb2 px3 py1 keyline-top'>
  9844. <div class='right py2'>
  9845. <span class="px2"></span>
  9846. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L163-L163'>
  9847. <span>lib/postcss.js</span>
  9848. </a>
  9849. </div>
  9850. <h3 class='regular'>
  9851. <a class='black' href='#postcssparse'>
  9852. <code>
  9853. parse
  9854. <span class='gray'>(css, opts?)</span>
  9855. </code>
  9856. </a>
  9857. </h3>
  9858. <p>Parses source css and returns a new <a href="#root">Root</a> node,
  9859. which contains the source CSS nodes.</p>
  9860. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9861. <thead class='fill-light'>
  9862. <th class='col-3 small caps quiet'>parameter</th>
  9863. <th class='col-3 small caps quiet'>type</th>
  9864. <th class='col-6 small caps quiet'>description</th>
  9865. </thead>
  9866. <tr>
  9867. <td class='col-3 strong'><code>css</code></td>
  9868. <td class='col-3 quiet'>
  9869. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="#tostring">toString</a>)
  9870. </td>
  9871. <td class='col-6'>String with input CSS or any object
  9872. with toString() method, like a Buffer
  9873. </td>
  9874. </tr>
  9875. <tr>
  9876. <td class='col-3 strong'><code>opts</code></td>
  9877. <td class='col-3 quiet'>
  9878. <a href="#processoptions">processOptions</a>?
  9879. </td>
  9880. <td class='col-6'>Options with only
  9881. <code>from</code>
  9882. and
  9883. <code>map</code>
  9884. keys.
  9885. </td>
  9886. </tr>
  9887. </table>
  9888. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9889. <code><a href="#root">Root</a></code>
  9890. :
  9891. <span class='force-inline'>PostCSS AST.
  9892. </span>
  9893. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9894. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-comment">// Simple CSS concatenation with source map support</span>
  9895. <span class="hljs-keyword">const</span> root1 = postcss.parse(css1, { <span class="hljs-attr">from</span>: file1 })
  9896. <span class="hljs-keyword">const</span> root2 = postcss.parse(css2, { <span class="hljs-attr">from</span>: file2 })
  9897. root1.append(root2).toResult().css</code></pre>
  9898. </section>
  9899. <section id='postcssvendor'class='mt2 mb2 px3 py1 keyline-top'>
  9900. <div class='right py2'>
  9901. <span class="px2"></span>
  9902. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L173-L173'>
  9903. <span>lib/postcss.js</span>
  9904. </a>
  9905. </div>
  9906. <h3 class='regular'>
  9907. <a class='black' href='#postcssvendor'>
  9908. <code>
  9909. vendor
  9910. <span class='gray'>()</span>
  9911. </code>
  9912. </a>
  9913. </h3>
  9914. <p>Contains the <a href="#vendor">vendor</a> module.</p>
  9915. <p>
  9916. Type:
  9917. <a href="#vendor">vendor</a>
  9918. </p>
  9919. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9920. <pre class='p1 overflow-auto round fill-light'><code>postcss.vendor.unprefixed(<span class="hljs-string">'-moz-tab'</span>) <span class="hljs-comment">//=&gt; ['tab']</span></code></pre>
  9921. </section>
  9922. <section id='postcsslist'class='mt2 mb2 px3 py1 keyline-top'>
  9923. <div class='right py2'>
  9924. <span class="px2"></span>
  9925. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L183-L183'>
  9926. <span>lib/postcss.js</span>
  9927. </a>
  9928. </div>
  9929. <h3 class='regular'>
  9930. <a class='black' href='#postcsslist'>
  9931. <code>
  9932. list
  9933. <span class='gray'>()</span>
  9934. </code>
  9935. </a>
  9936. </h3>
  9937. <p>Contains the <a href="#list">list</a> module.</p>
  9938. <p>
  9939. Type:
  9940. <a href="#list">list</a>
  9941. </p>
  9942. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9943. <pre class='p1 overflow-auto round fill-light'><code>postcss.list.space(<span class="hljs-string">'5px calc(10% + 5px)'</span>) <span class="hljs-comment">//=&gt; ['5px', 'calc(10% + 5px)']</span></code></pre>
  9944. </section>
  9945. <section id='postcsscomment'class='mt2 mb2 px3 py1 keyline-top'>
  9946. <div class='right py2'>
  9947. <span class="px2"></span>
  9948. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L195-L195'>
  9949. <span>lib/postcss.js</span>
  9950. </a>
  9951. </div>
  9952. <h3 class='regular'>
  9953. <a class='black' href='#postcsscomment'>
  9954. <code>
  9955. comment
  9956. <span class='gray'>(defaults?)</span>
  9957. </code>
  9958. </a>
  9959. </h3>
  9960. <p>Creates a new <a href="#comment">Comment</a> node.</p>
  9961. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  9962. <thead class='fill-light'>
  9963. <th class='col-3 small caps quiet'>parameter</th>
  9964. <th class='col-3 small caps quiet'>type</th>
  9965. <th class='col-6 small caps quiet'>description</th>
  9966. </thead>
  9967. <tr>
  9968. <td class='col-3 strong'><code>defaults</code></td>
  9969. <td class='col-3 quiet'>
  9970. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  9971. </td>
  9972. <td class='col-6'>Properties for the new node.
  9973. </td>
  9974. </tr>
  9975. </table>
  9976. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  9977. <code><a href="#comment">Comment</a></code>
  9978. :
  9979. <span class='force-inline'>New comment node
  9980. </span>
  9981. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  9982. <pre class='p1 overflow-auto round fill-light'><code>postcss.comment({ <span class="hljs-attr">text</span>: <span class="hljs-string">'test'</span> })</code></pre>
  9983. </section>
  9984. <section id='postcssatrule'class='mt2 mb2 px3 py1 keyline-top'>
  9985. <div class='right py2'>
  9986. <span class="px2"></span>
  9987. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L207-L207'>
  9988. <span>lib/postcss.js</span>
  9989. </a>
  9990. </div>
  9991. <h3 class='regular'>
  9992. <a class='black' href='#postcssatrule'>
  9993. <code>
  9994. atRule
  9995. <span class='gray'>(defaults?)</span>
  9996. </code>
  9997. </a>
  9998. </h3>
  9999. <p>Creates a new <a href="#atrule">AtRule</a> node.</p>
  10000. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10001. <thead class='fill-light'>
  10002. <th class='col-3 small caps quiet'>parameter</th>
  10003. <th class='col-3 small caps quiet'>type</th>
  10004. <th class='col-6 small caps quiet'>description</th>
  10005. </thead>
  10006. <tr>
  10007. <td class='col-3 strong'><code>defaults</code></td>
  10008. <td class='col-3 quiet'>
  10009. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  10010. </td>
  10011. <td class='col-6'>Properties for the new node.
  10012. </td>
  10013. </tr>
  10014. </table>
  10015. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10016. <code><a href="#atrule">AtRule</a></code>
  10017. :
  10018. <span class='force-inline'>new at-rule node
  10019. </span>
  10020. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  10021. <pre class='p1 overflow-auto round fill-light'><code>postcss.atRule({ <span class="hljs-attr">name</span>: <span class="hljs-string">'charset'</span> }).toString() <span class="hljs-comment">//=&gt; "@charset"</span></code></pre>
  10022. </section>
  10023. <section id='postcssdecl'class='mt2 mb2 px3 py1 keyline-top'>
  10024. <div class='right py2'>
  10025. <span class="px2"></span>
  10026. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L219-L219'>
  10027. <span>lib/postcss.js</span>
  10028. </a>
  10029. </div>
  10030. <h3 class='regular'>
  10031. <a class='black' href='#postcssdecl'>
  10032. <code>
  10033. decl
  10034. <span class='gray'>(defaults?)</span>
  10035. </code>
  10036. </a>
  10037. </h3>
  10038. <p>Creates a new <a href="#declaration">Declaration</a> node.</p>
  10039. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10040. <thead class='fill-light'>
  10041. <th class='col-3 small caps quiet'>parameter</th>
  10042. <th class='col-3 small caps quiet'>type</th>
  10043. <th class='col-6 small caps quiet'>description</th>
  10044. </thead>
  10045. <tr>
  10046. <td class='col-3 strong'><code>defaults</code></td>
  10047. <td class='col-3 quiet'>
  10048. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  10049. </td>
  10050. <td class='col-6'>Properties for the new node.
  10051. </td>
  10052. </tr>
  10053. </table>
  10054. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10055. <code><a href="#declaration">Declaration</a></code>
  10056. :
  10057. <span class='force-inline'>new declaration node
  10058. </span>
  10059. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  10060. <pre class='p1 overflow-auto round fill-light'><code>postcss.decl({ <span class="hljs-attr">prop</span>: <span class="hljs-string">'color'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'red'</span> }).toString() <span class="hljs-comment">//=&gt; "color: red"</span></code></pre>
  10061. </section>
  10062. <section id='postcssrule'class='mt2 mb2 px3 py1 keyline-top'>
  10063. <div class='right py2'>
  10064. <span class="px2"></span>
  10065. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L231-L231'>
  10066. <span>lib/postcss.js</span>
  10067. </a>
  10068. </div>
  10069. <h3 class='regular'>
  10070. <a class='black' href='#postcssrule'>
  10071. <code>
  10072. rule
  10073. <span class='gray'>(defaults?)</span>
  10074. </code>
  10075. </a>
  10076. </h3>
  10077. <p>Creates a new <a href="#rule">Rule</a> node.</p>
  10078. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10079. <thead class='fill-light'>
  10080. <th class='col-3 small caps quiet'>parameter</th>
  10081. <th class='col-3 small caps quiet'>type</th>
  10082. <th class='col-6 small caps quiet'>description</th>
  10083. </thead>
  10084. <tr>
  10085. <td class='col-3 strong'><code>defaults</code></td>
  10086. <td class='col-3 quiet'>
  10087. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  10088. </td>
  10089. <td class='col-6'>Properties for the new node.
  10090. </td>
  10091. </tr>
  10092. </table>
  10093. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10094. <code><a href="#rule">Rule</a></code>
  10095. :
  10096. <span class='force-inline'>new rule node
  10097. </span>
  10098. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  10099. <pre class='p1 overflow-auto round fill-light'><code>postcss.rule({ <span class="hljs-attr">selector</span>: <span class="hljs-string">'a'</span> }).toString() <span class="hljs-comment">//=&gt; "a {\n}"</span></code></pre>
  10100. </section>
  10101. <section id='postcssroot'class='mt2 mb2 px3 py1 keyline-top'>
  10102. <div class='right py2'>
  10103. <span class="px2"></span>
  10104. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/postcss.js#L243-L243'>
  10105. <span>lib/postcss.js</span>
  10106. </a>
  10107. </div>
  10108. <h3 class='regular'>
  10109. <a class='black' href='#postcssroot'>
  10110. <code>
  10111. root
  10112. <span class='gray'>(defaults?)</span>
  10113. </code>
  10114. </a>
  10115. </h3>
  10116. <p>Creates a new <a href="#root">Root</a> node.</p>
  10117. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10118. <thead class='fill-light'>
  10119. <th class='col-3 small caps quiet'>parameter</th>
  10120. <th class='col-3 small caps quiet'>type</th>
  10121. <th class='col-6 small caps quiet'>description</th>
  10122. </thead>
  10123. <tr>
  10124. <td class='col-3 strong'><code>defaults</code></td>
  10125. <td class='col-3 quiet'>
  10126. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>?
  10127. </td>
  10128. <td class='col-6'>Properties for the new node.
  10129. </td>
  10130. </tr>
  10131. </table>
  10132. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10133. <code><a href="#root">Root</a></code>
  10134. :
  10135. <span class='force-inline'>new root node.
  10136. </span>
  10137. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  10138. <pre class='p1 overflow-auto round fill-light'><code>postcss.root({ <span class="hljs-attr">after</span>: <span class="hljs-string">'\n'</span> }).toString() <span class="hljs-comment">//=&gt; "\n"</span></code></pre>
  10139. </section>
  10140. </div>
  10141. </section>
  10142. <section id='vendor'class='mt2 mb2 px3 py1 keyline-top'>
  10143. <div class='right py2'>
  10144. <span class="px2"></span>
  10145. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/vendor.js#L9-L45'>
  10146. <span>lib/vendor.js</span>
  10147. </a>
  10148. </div>
  10149. <h3 class='regular'>
  10150. <a class='black' href='#vendor'>
  10151. <code>
  10152. vendor
  10153. <span class='gray'>()</span>
  10154. </code>
  10155. </a>
  10156. </h3>
  10157. <p>Contains helpers for working with vendor prefixes.</p>
  10158. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  10159. <pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> vendor = postcss.vendor</code></pre>
  10160. <h4 class='caps quiet mb2 mt3'>Static Members</h4>
  10161. <div class="section-indent">
  10162. <section id='vendorprefix'class='mt2 mb2 px3 py1 keyline-top'>
  10163. <div class='right py2'>
  10164. <span class="px2"></span>
  10165. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/vendor.js#L22-L29'>
  10166. <span>lib/vendor.js</span>
  10167. </a>
  10168. </div>
  10169. <h3 class='regular'>
  10170. <a class='black' href='#vendorprefix'>
  10171. <code>
  10172. prefix
  10173. <span class='gray'>(prop)</span>
  10174. </code>
  10175. </a>
  10176. </h3>
  10177. <p>Returns the vendor prefix extracted from an input string.</p>
  10178. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10179. <thead class='fill-light'>
  10180. <th class='col-3 small caps quiet'>parameter</th>
  10181. <th class='col-3 small caps quiet'>type</th>
  10182. <th class='col-6 small caps quiet'>description</th>
  10183. </thead>
  10184. <tr>
  10185. <td class='col-3 strong'><code>prop</code></td>
  10186. <td class='col-3 quiet'>
  10187. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  10188. </td>
  10189. <td class='col-6'>String with or without vendor prefix.
  10190. </td>
  10191. </tr>
  10192. </table>
  10193. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10194. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  10195. :
  10196. <span class='force-inline'>vendor prefix or empty string
  10197. </span>
  10198. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  10199. <pre class='p1 overflow-auto round fill-light'><code>postcss.vendor.prefix(<span class="hljs-string">'-moz-tab-size'</span>) <span class="hljs-comment">//=&gt; '-moz-'</span>
  10200. postcss.vendor.prefix(<span class="hljs-string">'tab-size'</span>) <span class="hljs-comment">//=&gt; ''</span></code></pre>
  10201. </section>
  10202. <section id='vendorunprefixed'class='mt2 mb2 px3 py1 keyline-top'>
  10203. <div class='right py2'>
  10204. <span class="px2"></span>
  10205. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/vendor.js#L41-L43'>
  10206. <span>lib/vendor.js</span>
  10207. </a>
  10208. </div>
  10209. <h3 class='regular'>
  10210. <a class='black' href='#vendorunprefixed'>
  10211. <code>
  10212. unprefixed
  10213. <span class='gray'>(prop)</span>
  10214. </code>
  10215. </a>
  10216. </h3>
  10217. <p>Returns the input string stripped of its vendor prefix.</p>
  10218. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10219. <thead class='fill-light'>
  10220. <th class='col-3 small caps quiet'>parameter</th>
  10221. <th class='col-3 small caps quiet'>type</th>
  10222. <th class='col-6 small caps quiet'>description</th>
  10223. </thead>
  10224. <tr>
  10225. <td class='col-3 strong'><code>prop</code></td>
  10226. <td class='col-3 quiet'>
  10227. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  10228. </td>
  10229. <td class='col-6'>String with or without vendor prefix.
  10230. </td>
  10231. </tr>
  10232. </table>
  10233. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10234. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>
  10235. :
  10236. <span class='force-inline'>String name without vendor prefixes.
  10237. </span>
  10238. <h4 class='caps quiet mb1 mt3'>Examples</h4>
  10239. <pre class='p1 overflow-auto round fill-light'><code>postcss.vendor.unprefixed(<span class="hljs-string">'-moz-tab-size'</span>) <span class="hljs-comment">//=&gt; 'tab-size'</span></code></pre>
  10240. </section>
  10241. </div>
  10242. </section>
  10243. <div class="hide">
  10244. <section class='py2 clearfix'>
  10245. <h2 id='global' class='mt0'>
  10246. GLOBAL
  10247. </h2>
  10248. </section>
  10249. </div>
  10250. <section id='message'class='mt2 mb2 px3 py1 keyline-top'>
  10251. <div class='right py2'>
  10252. <span class="px2"></span>
  10253. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/result.js#L174-L178'>
  10254. <span>lib/result.js</span>
  10255. </a>
  10256. </div>
  10257. <h3 class='regular'>
  10258. <a class='black' href='#message'>
  10259. <code>
  10260. Message
  10261. <span class='gray'>()</span>
  10262. </code>
  10263. </a>
  10264. </h3>
  10265. <p>
  10266. Type:
  10267. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  10268. </p>
  10269. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10270. <thead class='fill-light'>
  10271. <th class='col-2 small caps quiet'>property</th>
  10272. <th class='col-2 small caps quiet'>type</th>
  10273. <th class='col-8 small caps quiet'>description</th>
  10274. </thead>
  10275. <tr>
  10276. <td class='col-2 strong'>type</td>
  10277. <td class='col-2 quiet'>
  10278. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  10279. </td>
  10280. <td class='col-8'>: Message type.
  10281. </td>
  10282. </tr>
  10283. <tr>
  10284. <td class='col-2 strong'>plugin</td>
  10285. <td class='col-2 quiet'>
  10286. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  10287. </td>
  10288. <td class='col-8'>: Source PostCSS plugin name.
  10289. </td>
  10290. </tr>
  10291. </table>
  10292. </section>
  10293. <section id='plugin'class='mt2 mb2 px3 py1 keyline-top'>
  10294. <div class='right py2'>
  10295. <span class="px2"></span>
  10296. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L183-L186'>
  10297. <span>lib/processor.js</span>
  10298. </a>
  10299. </div>
  10300. <h3 class='regular'>
  10301. <a class='black' href='#plugin'>
  10302. <code>
  10303. Plugin
  10304. <span class='gray'>()</span>
  10305. </code>
  10306. </a>
  10307. </h3>
  10308. <p>
  10309. Type:
  10310. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  10311. </p>
  10312. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10313. <thead class='fill-light'>
  10314. <th class='col-2 small caps quiet'>property</th>
  10315. <th class='col-2 small caps quiet'>type</th>
  10316. <th class='col-8 small caps quiet'>description</th>
  10317. </thead>
  10318. <tr>
  10319. <td class='col-2 strong'>postcss</td>
  10320. <td class='col-2 quiet'>
  10321. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a>
  10322. </td>
  10323. <td class='col-8'>: PostCSS plugin function.
  10324. </td>
  10325. </tr>
  10326. </table>
  10327. </section>
  10328. <section id='builder'class='mt2 mb2 px3 py1 keyline-top'>
  10329. <div class='right py2'>
  10330. <span class="px2"></span>
  10331. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L139-L144'>
  10332. <span>lib/processor.js</span>
  10333. </a>
  10334. </div>
  10335. <h3 class='regular'>
  10336. <a class='black' href='#builder'>
  10337. <code>
  10338. builder
  10339. <span class='gray'>(part, node, type?)</span>
  10340. </code>
  10341. </a>
  10342. </h3>
  10343. <p>
  10344. Type:
  10345. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>
  10346. </p>
  10347. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10348. <thead class='fill-light'>
  10349. <th class='col-3 small caps quiet'>parameter</th>
  10350. <th class='col-3 small caps quiet'>type</th>
  10351. <th class='col-6 small caps quiet'>description</th>
  10352. </thead>
  10353. <tr>
  10354. <td class='col-3 strong'><code>part</code></td>
  10355. <td class='col-3 quiet'>
  10356. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  10357. </td>
  10358. <td class='col-6'>Part of generated CSS connected to this node.
  10359. </td>
  10360. </tr>
  10361. <tr>
  10362. <td class='col-3 strong'><code>node</code></td>
  10363. <td class='col-3 quiet'>
  10364. <a href="#node">Node</a>
  10365. </td>
  10366. <td class='col-6'>AST node.
  10367. </td>
  10368. </tr>
  10369. <tr>
  10370. <td class='col-3 strong'><code>type</code></td>
  10371. <td class='col-3 quiet'>
  10372. (<code>"start"</code> | <code>"end"</code>)?
  10373. </td>
  10374. <td class='col-6'>Node’s part type.
  10375. </td>
  10376. </tr>
  10377. </table>
  10378. </section>
  10379. <section id='childcondition'class='mt2 mb2 px3 py1 keyline-top'>
  10380. <div class='right py2'>
  10381. <span class="px2"></span>
  10382. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L697-L703'>
  10383. <span>lib/container.js</span>
  10384. </a>
  10385. </div>
  10386. <h3 class='regular'>
  10387. <a class='black' href='#childcondition'>
  10388. <code>
  10389. childCondition
  10390. <span class='gray'>(node, index, nodes)</span>
  10391. </code>
  10392. </a>
  10393. </h3>
  10394. <p>
  10395. Type:
  10396. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>
  10397. </p>
  10398. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10399. <thead class='fill-light'>
  10400. <th class='col-3 small caps quiet'>parameter</th>
  10401. <th class='col-3 small caps quiet'>type</th>
  10402. <th class='col-6 small caps quiet'>description</th>
  10403. </thead>
  10404. <tr>
  10405. <td class='col-3 strong'><code>node</code></td>
  10406. <td class='col-3 quiet'>
  10407. <a href="#node">Node</a>
  10408. </td>
  10409. <td class='col-6'>Container child.
  10410. </td>
  10411. </tr>
  10412. <tr>
  10413. <td class='col-3 strong'><code>index</code></td>
  10414. <td class='col-3 quiet'>
  10415. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  10416. </td>
  10417. <td class='col-6'>Child index.
  10418. </td>
  10419. </tr>
  10420. <tr>
  10421. <td class='col-3 strong'><code>nodes</code></td>
  10422. <td class='col-3 quiet'>
  10423. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#node">Node</a>>
  10424. </td>
  10425. <td class='col-6'>All container children.
  10426. </td>
  10427. </tr>
  10428. </table>
  10429. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10430. <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
  10431. :
  10432. <span class='force-inline'>
  10433. </span>
  10434. </section>
  10435. <section id='childiterator'class='mt2 mb2 px3 py1 keyline-top'>
  10436. <div class='right py2'>
  10437. <span class="px2"></span>
  10438. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/container.js#L705-L710'>
  10439. <span>lib/container.js</span>
  10440. </a>
  10441. </div>
  10442. <h3 class='regular'>
  10443. <a class='black' href='#childiterator'>
  10444. <code>
  10445. childIterator
  10446. <span class='gray'>(node, index)</span>
  10447. </code>
  10448. </a>
  10449. </h3>
  10450. <p>
  10451. Type:
  10452. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>
  10453. </p>
  10454. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10455. <thead class='fill-light'>
  10456. <th class='col-3 small caps quiet'>parameter</th>
  10457. <th class='col-3 small caps quiet'>type</th>
  10458. <th class='col-6 small caps quiet'>description</th>
  10459. </thead>
  10460. <tr>
  10461. <td class='col-3 strong'><code>node</code></td>
  10462. <td class='col-3 quiet'>
  10463. <a href="#node">Node</a>
  10464. </td>
  10465. <td class='col-6'>Container child.
  10466. </td>
  10467. </tr>
  10468. <tr>
  10469. <td class='col-3 strong'><code>index</code></td>
  10470. <td class='col-3 quiet'>
  10471. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  10472. </td>
  10473. <td class='col-6'>Child index.
  10474. </td>
  10475. </tr>
  10476. </table>
  10477. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10478. <code>(<code>false</code> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a>)</code>
  10479. :
  10480. <span class='force-inline'>Returning
  10481. <code>false</code>
  10482. will break iteration.
  10483. </span>
  10484. </section>
  10485. <section id='fileposition'class='mt2 mb2 px3 py1 keyline-top'>
  10486. <div class='right py2'>
  10487. <span class="px2"></span>
  10488. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/input.js#L171-L176'>
  10489. <span>lib/input.js</span>
  10490. </a>
  10491. </div>
  10492. <h3 class='regular'>
  10493. <a class='black' href='#fileposition'>
  10494. <code>
  10495. filePosition
  10496. <span class='gray'>()</span>
  10497. </code>
  10498. </a>
  10499. </h3>
  10500. <p>
  10501. Type:
  10502. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  10503. </p>
  10504. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10505. <thead class='fill-light'>
  10506. <th class='col-2 small caps quiet'>property</th>
  10507. <th class='col-2 small caps quiet'>type</th>
  10508. <th class='col-8 small caps quiet'>description</th>
  10509. </thead>
  10510. <tr>
  10511. <td class='col-2 strong'>file</td>
  10512. <td class='col-2 quiet'>
  10513. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  10514. </td>
  10515. <td class='col-8'>: Path to file.
  10516. </td>
  10517. </tr>
  10518. <tr>
  10519. <td class='col-2 strong'>line</td>
  10520. <td class='col-2 quiet'>
  10521. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  10522. </td>
  10523. <td class='col-8'>: Source line in file.
  10524. </td>
  10525. </tr>
  10526. <tr>
  10527. <td class='col-2 strong'>column</td>
  10528. <td class='col-2 quiet'>
  10529. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  10530. </td>
  10531. <td class='col-8'>: Source column in file.
  10532. </td>
  10533. </tr>
  10534. </table>
  10535. </section>
  10536. <section id='onfulfilled'class='mt2 mb2 px3 py1 keyline-top'>
  10537. <div class='right py2'>
  10538. <span class="px2"></span>
  10539. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L431-L434'>
  10540. <span>lib/lazy-result.js</span>
  10541. </a>
  10542. </div>
  10543. <h3 class='regular'>
  10544. <a class='black' href='#onfulfilled'>
  10545. <code>
  10546. onFulfilled
  10547. <span class='gray'>(result)</span>
  10548. </code>
  10549. </a>
  10550. </h3>
  10551. <p>
  10552. Type:
  10553. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>
  10554. </p>
  10555. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10556. <thead class='fill-light'>
  10557. <th class='col-3 small caps quiet'>parameter</th>
  10558. <th class='col-3 small caps quiet'>type</th>
  10559. <th class='col-6 small caps quiet'>description</th>
  10560. </thead>
  10561. <tr>
  10562. <td class='col-3 strong'><code>result</code></td>
  10563. <td class='col-3 quiet'>
  10564. <a href="#result">Result</a>
  10565. </td>
  10566. <td class='col-6'></td>
  10567. </tr>
  10568. </table>
  10569. </section>
  10570. <section id='onrejected'class='mt2 mb2 px3 py1 keyline-top'>
  10571. <div class='right py2'>
  10572. <span class="px2"></span>
  10573. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/lazy-result.js#L436-L439'>
  10574. <span>lib/lazy-result.js</span>
  10575. </a>
  10576. </div>
  10577. <h3 class='regular'>
  10578. <a class='black' href='#onrejected'>
  10579. <code>
  10580. onRejected
  10581. <span class='gray'>(error)</span>
  10582. </code>
  10583. </a>
  10584. </h3>
  10585. <p>
  10586. Type:
  10587. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>
  10588. </p>
  10589. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10590. <thead class='fill-light'>
  10591. <th class='col-3 small caps quiet'>parameter</th>
  10592. <th class='col-3 small caps quiet'>type</th>
  10593. <th class='col-6 small caps quiet'>description</th>
  10594. </thead>
  10595. <tr>
  10596. <td class='col-3 strong'><code>error</code></td>
  10597. <td class='col-3 quiet'>
  10598. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>
  10599. </td>
  10600. <td class='col-6'></td>
  10601. </tr>
  10602. </table>
  10603. </section>
  10604. <section id='parser'class='mt2 mb2 px3 py1 keyline-top'>
  10605. <div class='right py2'>
  10606. <span class="px2"></span>
  10607. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L146-L154'>
  10608. <span>lib/processor.js</span>
  10609. </a>
  10610. </div>
  10611. <h3 class='regular'>
  10612. <a class='black' href='#parser'>
  10613. <code>
  10614. parser
  10615. <span class='gray'>(css, opts?)</span>
  10616. </code>
  10617. </a>
  10618. </h3>
  10619. <p>
  10620. Type:
  10621. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>
  10622. </p>
  10623. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10624. <thead class='fill-light'>
  10625. <th class='col-3 small caps quiet'>parameter</th>
  10626. <th class='col-3 small caps quiet'>type</th>
  10627. <th class='col-6 small caps quiet'>description</th>
  10628. </thead>
  10629. <tr>
  10630. <td class='col-3 strong'><code>css</code></td>
  10631. <td class='col-3 quiet'>
  10632. (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="#tostring">toString</a>)
  10633. </td>
  10634. <td class='col-6'>String with input CSS or any object
  10635. with toString() method, like a Buffer.
  10636. </td>
  10637. </tr>
  10638. <tr>
  10639. <td class='col-3 strong'><code>opts</code></td>
  10640. <td class='col-3 quiet'>
  10641. <a href="#processoptions">processOptions</a>?
  10642. </td>
  10643. <td class='col-6'>Options with only
  10644. <code>from</code>
  10645. and
  10646. <code>map</code>
  10647. keys.
  10648. </td>
  10649. </tr>
  10650. </table>
  10651. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10652. <code><a href="#root">Root</a></code>
  10653. :
  10654. <span class='force-inline'>PostCSS AST
  10655. </span>
  10656. </section>
  10657. <section id='pluginfunction'class='mt2 mb2 px3 py1 keyline-top'>
  10658. <div class='right py2'>
  10659. <span class="px2"></span>
  10660. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L177-L181'>
  10661. <span>lib/processor.js</span>
  10662. </a>
  10663. </div>
  10664. <h3 class='regular'>
  10665. <a class='black' href='#pluginfunction'>
  10666. <code>
  10667. pluginFunction
  10668. <span class='gray'>(root, result)</span>
  10669. </code>
  10670. </a>
  10671. </h3>
  10672. <p>
  10673. Type:
  10674. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>
  10675. </p>
  10676. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10677. <thead class='fill-light'>
  10678. <th class='col-3 small caps quiet'>parameter</th>
  10679. <th class='col-3 small caps quiet'>type</th>
  10680. <th class='col-6 small caps quiet'>description</th>
  10681. </thead>
  10682. <tr>
  10683. <td class='col-3 strong'><code>root</code></td>
  10684. <td class='col-3 quiet'>
  10685. <a href="#root">Root</a>
  10686. </td>
  10687. <td class='col-6'>Parsed input CSS.
  10688. </td>
  10689. </tr>
  10690. <tr>
  10691. <td class='col-3 strong'><code>result</code></td>
  10692. <td class='col-3 quiet'>
  10693. <a href="#result">Result</a>
  10694. </td>
  10695. <td class='col-6'>Result to set warnings or check other plugins.
  10696. </td>
  10697. </tr>
  10698. </table>
  10699. </section>
  10700. <section id='position'class='mt2 mb2 px3 py1 keyline-top'>
  10701. <div class='right py2'>
  10702. <span class="px2"></span>
  10703. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L568-L572'>
  10704. <span>lib/node.js</span>
  10705. </a>
  10706. </div>
  10707. <h3 class='regular'>
  10708. <a class='black' href='#position'>
  10709. <code>
  10710. position
  10711. <span class='gray'>()</span>
  10712. </code>
  10713. </a>
  10714. </h3>
  10715. <p>
  10716. Type:
  10717. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  10718. </p>
  10719. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10720. <thead class='fill-light'>
  10721. <th class='col-2 small caps quiet'>property</th>
  10722. <th class='col-2 small caps quiet'>type</th>
  10723. <th class='col-8 small caps quiet'>description</th>
  10724. </thead>
  10725. <tr>
  10726. <td class='col-2 strong'>line</td>
  10727. <td class='col-2 quiet'>
  10728. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  10729. </td>
  10730. <td class='col-8'>: Source line in file.
  10731. </td>
  10732. </tr>
  10733. <tr>
  10734. <td class='col-2 strong'>column</td>
  10735. <td class='col-2 quiet'>
  10736. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  10737. </td>
  10738. <td class='col-8'>: Source column in file.
  10739. </td>
  10740. </tr>
  10741. </table>
  10742. </section>
  10743. <section id='processoptions'class='mt2 mb2 px3 py1 keyline-top'>
  10744. <div class='right py2'>
  10745. <span class="px2"></span>
  10746. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L188-L219'>
  10747. <span>lib/processor.js</span>
  10748. </a>
  10749. </div>
  10750. <h3 class='regular'>
  10751. <a class='black' href='#processoptions'>
  10752. <code>
  10753. processOptions
  10754. <span class='gray'>()</span>
  10755. </code>
  10756. </a>
  10757. </h3>
  10758. <p>
  10759. Type:
  10760. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  10761. </p>
  10762. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10763. <thead class='fill-light'>
  10764. <th class='col-2 small caps quiet'>property</th>
  10765. <th class='col-2 small caps quiet'>type</th>
  10766. <th class='col-8 small caps quiet'>description</th>
  10767. </thead>
  10768. <tr>
  10769. <td class='col-2 strong'>from</td>
  10770. <td class='col-2 quiet'>
  10771. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  10772. </td>
  10773. <td class='col-8'>: The path of the CSS source file.
  10774. You should always set
  10775. <code>from</code>
  10776. ,
  10777. because it is used in source map
  10778. generation and syntax error messages.
  10779. </td>
  10780. </tr>
  10781. <tr>
  10782. <td class='col-2 strong'>to</td>
  10783. <td class='col-2 quiet'>
  10784. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>
  10785. </td>
  10786. <td class='col-8'>: The path where you’ll put the output
  10787. CSS file. You should always set
  10788. <code>to</code>
  10789. to generate correct source maps.
  10790. </td>
  10791. </tr>
  10792. <tr>
  10793. <td class='col-2 strong'>parser</td>
  10794. <td class='col-2 quiet'>
  10795. <a href="#parser">parser</a>
  10796. </td>
  10797. <td class='col-8'>: Function to generate AST by string.
  10798. </td>
  10799. </tr>
  10800. <tr>
  10801. <td class='col-2 strong'>stringifier</td>
  10802. <td class='col-2 quiet'>
  10803. <a href="#stringifier">stringifier</a>
  10804. </td>
  10805. <td class='col-8'>: Class to generate string by AST.
  10806. </td>
  10807. </tr>
  10808. <tr>
  10809. <td class='col-2 strong'>syntax</td>
  10810. <td class='col-2 quiet'>
  10811. <a href="#syntax">syntax</a>
  10812. </td>
  10813. <td class='col-8'>: Object with
  10814. <code>parse</code>
  10815. and
  10816. <code>stringify</code>
  10817. .
  10818. </td>
  10819. </tr>
  10820. <tr>
  10821. <td class='col-2 strong'>map</td>
  10822. <td class='col-2 quiet'>
  10823. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  10824. </td>
  10825. <td class='col-8'>: Source map options.
  10826. </td>
  10827. </tr>
  10828. <tr>
  10829. <td class='col-2 strong'>map</td>
  10830. <td class='col-2 quiet'>
  10831. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  10832. </td>
  10833. <td class='col-8'>: Source map options.
  10834. </td>
  10835. </tr>
  10836. </table>
  10837. </section>
  10838. <section id='source'class='mt2 mb2 px3 py1 keyline-top'>
  10839. <div class='right py2'>
  10840. <span class="px2"></span>
  10841. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/node.js#L574-L579'>
  10842. <span>lib/node.js</span>
  10843. </a>
  10844. </div>
  10845. <h3 class='regular'>
  10846. <a class='black' href='#source'>
  10847. <code>
  10848. source
  10849. <span class='gray'>()</span>
  10850. </code>
  10851. </a>
  10852. </h3>
  10853. <p>
  10854. Type:
  10855. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  10856. </p>
  10857. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10858. <thead class='fill-light'>
  10859. <th class='col-2 small caps quiet'>property</th>
  10860. <th class='col-2 small caps quiet'>type</th>
  10861. <th class='col-8 small caps quiet'>description</th>
  10862. </thead>
  10863. <tr>
  10864. <td class='col-2 strong'>input</td>
  10865. <td class='col-2 quiet'>
  10866. <a href="#input">Input</a>
  10867. </td>
  10868. <td class='col-8'>: <a href="#input">Input</a>
  10869. with input file
  10870. </td>
  10871. </tr>
  10872. <tr>
  10873. <td class='col-2 strong'>start</td>
  10874. <td class='col-2 quiet'>
  10875. <a href="#position">position</a>
  10876. </td>
  10877. <td class='col-8'>: The starting position of the node’s source.
  10878. </td>
  10879. </tr>
  10880. <tr>
  10881. <td class='col-2 strong'>end</td>
  10882. <td class='col-2 quiet'>
  10883. <a href="#position">position</a>
  10884. </td>
  10885. <td class='col-8'>: The ending position of the node’s source.
  10886. </td>
  10887. </tr>
  10888. </table>
  10889. </section>
  10890. <section id='stringifier'class='mt2 mb2 px3 py1 keyline-top'>
  10891. <div class='right py2'>
  10892. <span class="px2"></span>
  10893. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L156-L164'>
  10894. <span>lib/processor.js</span>
  10895. </a>
  10896. </div>
  10897. <h3 class='regular'>
  10898. <a class='black' href='#stringifier'>
  10899. <code>
  10900. stringifier
  10901. <span class='gray'>(node, builder)</span>
  10902. </code>
  10903. </a>
  10904. </h3>
  10905. <p>
  10906. Type:
  10907. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>
  10908. </p>
  10909. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10910. <thead class='fill-light'>
  10911. <th class='col-3 small caps quiet'>parameter</th>
  10912. <th class='col-3 small caps quiet'>type</th>
  10913. <th class='col-6 small caps quiet'>description</th>
  10914. </thead>
  10915. <tr>
  10916. <td class='col-3 strong'><code>node</code></td>
  10917. <td class='col-3 quiet'>
  10918. <a href="#node">Node</a>
  10919. </td>
  10920. <td class='col-6'>Start node for stringifing. Usually
  10921. <a href="#root">Root</a>
  10922. .
  10923. </td>
  10924. </tr>
  10925. <tr>
  10926. <td class='col-3 strong'><code>builder</code></td>
  10927. <td class='col-3 quiet'>
  10928. <a href="#builder">builder</a>
  10929. </td>
  10930. <td class='col-6'>Function to concatenate CSS from node’s parts
  10931. or generate string and source map.
  10932. </td>
  10933. </tr>
  10934. </table>
  10935. <h4 class='caps quiet mb1 mt3'>Returns</h4>
  10936. <code>void</code>
  10937. :
  10938. <span class='force-inline'>
  10939. </span>
  10940. </section>
  10941. <section id='syntax'class='mt2 mb2 px3 py1 keyline-top'>
  10942. <div class='right py2'>
  10943. <span class="px2"></span>
  10944. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L166-L170'>
  10945. <span>lib/processor.js</span>
  10946. </a>
  10947. </div>
  10948. <h3 class='regular'>
  10949. <a class='black' href='#syntax'>
  10950. <code>
  10951. syntax
  10952. <span class='gray'>()</span>
  10953. </code>
  10954. </a>
  10955. </h3>
  10956. <p>
  10957. Type:
  10958. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  10959. </p>
  10960. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  10961. <thead class='fill-light'>
  10962. <th class='col-2 small caps quiet'>property</th>
  10963. <th class='col-2 small caps quiet'>type</th>
  10964. <th class='col-8 small caps quiet'>description</th>
  10965. </thead>
  10966. <tr>
  10967. <td class='col-2 strong'>parse</td>
  10968. <td class='col-2 quiet'>
  10969. <a href="#parser">parser</a>
  10970. </td>
  10971. <td class='col-8'>: Function to generate AST by string.
  10972. </td>
  10973. </tr>
  10974. <tr>
  10975. <td class='col-2 strong'>stringify</td>
  10976. <td class='col-2 quiet'>
  10977. <a href="#stringifier">stringifier</a>
  10978. </td>
  10979. <td class='col-8'>: Function to generate string by AST.
  10980. </td>
  10981. </tr>
  10982. </table>
  10983. </section>
  10984. <section id='tostring'class='mt2 mb2 px3 py1 keyline-top'>
  10985. <div class='right py2'>
  10986. <span class="px2"></span>
  10987. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/processor.js#L172-L175'>
  10988. <span>lib/processor.js</span>
  10989. </a>
  10990. </div>
  10991. <h3 class='regular'>
  10992. <a class='black' href='#tostring'>
  10993. <code>
  10994. toString
  10995. <span class='gray'>()</span>
  10996. </code>
  10997. </a>
  10998. </h3>
  10999. <p>
  11000. Type:
  11001. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>
  11002. </p>
  11003. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  11004. <thead class='fill-light'>
  11005. <th class='col-2 small caps quiet'>property</th>
  11006. <th class='col-2 small caps quiet'>type</th>
  11007. <th class='col-8 small caps quiet'>description</th>
  11008. </thead>
  11009. <tr>
  11010. <td class='col-2 strong'>toString</td>
  11011. <td class='col-2 quiet'>
  11012. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a>
  11013. </td>
  11014. <td class='col-8'></td>
  11015. </tr>
  11016. </table>
  11017. </section>
  11018. <section id='visitor'class='mt2 mb2 px3 py1 keyline-top'>
  11019. <div class='right py2'>
  11020. <span class="px2"></span>
  11021. <a class='fr fill-darken0 round round pad1x quiet h5' href='https://git@github.com/:postcss/postcss/blob/ae7cf844d806d0e9f536cfd5b5a680070ebed3ce/lib/root.js#L118-L122'>
  11022. <span>lib/root.js</span>
  11023. </a>
  11024. </div>
  11025. <h3 class='regular'>
  11026. <a class='black' href='#visitor'>
  11027. <code>
  11028. visitor
  11029. <span class='gray'>(node, index)</span>
  11030. </code>
  11031. </a>
  11032. </h3>
  11033. <p>
  11034. Type:
  11035. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a>
  11036. </p>
  11037. <table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
  11038. <thead class='fill-light'>
  11039. <th class='col-3 small caps quiet'>parameter</th>
  11040. <th class='col-3 small caps quiet'>type</th>
  11041. <th class='col-6 small caps quiet'>description</th>
  11042. </thead>
  11043. <tr>
  11044. <td class='col-3 strong'><code>node</code></td>
  11045. <td class='col-3 quiet'>
  11046. <a href="#node">Node</a>
  11047. </td>
  11048. <td class='col-6'>Container child.
  11049. </td>
  11050. </tr>
  11051. <tr>
  11052. <td class='col-3 strong'><code>index</code></td>
  11053. <td class='col-3 quiet'>
  11054. <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
  11055. </td>
  11056. <td class='col-6'>Child index.
  11057. </td>
  11058. </tr>
  11059. </table>
  11060. </section>
  11061. </div>
  11062. </div>
  11063. </div>
  11064. </div>
  11065. <script src='assets/scripts.min.js'></script>
  11066. </body>
  11067. </html>