Andlala Bootstrap ku tirhisa switayele leswi katsekaka na swiphemu, xikan’we na swilo leswi cinca-cincaka swa LESS na mixins.
Bootstrap yi endliwe hi LESS eka xisekelo xa yona, ririmi ra xitayili lexi cinca-cincaka leri endliweke hi munghana wa hina lonene, Alexis Sellier . Swi endla leswaku ku tumbuluxa CSS leyi sekeriweke eka tisisiteme swi hatlisa, swi olova naswona swi tsakisa.
Un’wana wa vatumbuluxi va Bootstrap u tsarile xiviko xa xihatla xa blog mayelana na leswi , lexi katsakanyiweke laha:
Tanihi ku engeteriwa ka CSS, LESS yi katsa swilo leswi cinca-cincaka, mixins ya swiphemu swa khodi leswi tirhisiwaka nakambe, matirhelo ya tinhlayo to olova, ku endla swisaka, hambi ku ri mintirho ya mihlovo.
Endzela webusayiti ya ximfumo eka http://lesscss.org/ ku dyondza swo tala.
Tanihi leswi CSS ya hina yi tsariweke hi Less naswona yi tirhisaka swilo leswi cinca-cincaka na mixins, yi lava ku hlengeletiwa leswaku ku ta tirhisiwa vuhumelerisi byo hetelela. Hi leyi ndlela leyi.
Nghenisa muhlengeleti wa layini ya swileriso ya LESS, JSHint, Recess, na uglify-js emisaveni hinkwayo hi npm hi ku tirhisa xileriso lexi landzelaka:
$ npm nghenisa -g ehansi jshint nkarhi wo wisa uglify-js
Loko se u nghenisiwile ntsena tsutsuma make
ku suka eka rimitsu ra bootstrap directory ya wena naswona u vekiwile hinkwenu.
Ku engetela kwalaho, loko u ri na watchr leyi nghenisiweke, u nga ha tsutsuma make watch
leswaku bootstrap yi akiwa nakambe hi ku tisungulela nkarhi wun’wana ni wun’wana loko u hlela fayili eka bootstrap lib (leswi a swi laveki, i ndlela yo olova ntsena).
Nghenisa xitirhisiwa xa layini ya swileriso xa LESS hi ku tirhisa Node ivi u tirhisa xileriso lexi landzelaka:
$ lessc ./less/xiphemu xa xirhendzevutani.less > xirhangiso xa xirhendzevutani.css
Tiyiseka leswaku u katsa --compress
eka xileriso xexo loko u ringeta ku hlayisa tibayiti tin’wana!
Download Less.js ya sweswinyana ivi u katsa ndlela yo ya eka yona (na Bootstrap) eka <head>
.
<link rel = "xiphephana xa xitayili/le hansi" href = "/ndlela/ku ya eka/bootstrap.less" > <script src = "/ndlela/ku ya eka/le hansi.js" ></script>
Ku tlhela u hlengeleta tifayela ta .less, ti hlayise ntsena ivi u tlhela u layicha tluka ra wena. Less.js yi ti hlengeleta no ti hlayisa eka vuhlayiselo bya laha kaya.
App leyi nga riki ya ximfumo ya Mac yi hlalela tidayirekitara ta tifayela ta .less naswona yi hlengeleta khodi eka tifayela ta laha kaya endzhaku ka ku hlayisiwa kun’wana ni kun’wana ka fayili ya .less leyi hlaleriweke. Loko u swi tsakela, u nga cinca-cinca leswi u swi tsakelaka eka app leswaku u ta hunguta hi ku tisungulela ni leswaku tifayela leti hlengeletiweke ti hetelelaka ti ri eka xikombo xihi.
Crunch i muhleri na muhlengeleti wa LESS loyi a langutekaka kahle swinene loyi a akiweke eka Adobe Air.
Yi endliwe hi jaha leri fanaka na app ya Mac leyi nga riki ya ximfumo, CodeKit i app ya Mac leyi hlengeletaka LESS, SASS, Stylus, na CoffeeScript.
Mac, Linux, na Windows app ya ku koka na ku hoxa ku hlengeleta tifayela ta LESS. Ku engetela kwalaho, khodi ya xihlovo yi le ka GitHub .
Hi ku hatlisa sungula phurojeke yihi na yihi ya webu hi ku hoxa eka CSS na JS leswi hlengeletiweke kumbe leswi hungutiweke. Layer eka switayele swa ntolovelo hi ku hambana ku olovisa ku ndlandlamuxiwa na ku hlayisa ku ya emahlweni.
Download Bootstrap ya sweswinyana leyi hlengeletiweke ivi u yi veka eka phurojeke ya wena. Hi xikombiso, u nga ha va ni nchumu wo fana ni lowu:
app/ . swivumbeko/ . tithempleyiti/ . rivaleni/ css/ . xirhendzevutani xa xirhendzevutani.min.css js/ . xitsonga xitsonga.min.js img/ . ti-glyphicon-swiphemu swa hafu.png glyphicons-swiphemu swa hafu-yo basa.png
Kopa HTML ya xisekelo leyi landzelaka ku sungula.
- <html>
- <nhloko>
- <title> Xifaniso xa Bootstrap 101 </title>
- <!-- Xirhendzevutani xa xirhendzevutani -->
- <link href = "xitsonga/css/bootstrap.min.css" rel = "xiphephana xa xitayili" >
- </head>
- <miri>
- <h1> Xewani, misava! </h1>
- <!-- Xirhendzevutani xa xirhendzevutani -->
- <script src = "xitshuriwa xa mani na mani/js/bootstrap.min.js" ></script>
- </body>
- </html>
Tirha eka CSS ya wena ya ntolovelo, JS, na swin’wana tanihilaha swi lavekaka hakona ku endla Bootstrap ya wena hi tifayela ta wena ta CSS na JS leti hambaneke.
- <html>
- <nhloko>
- <title> Xifaniso xa Bootstrap 101 </title>
- <!-- Xirhendzevutani xa xirhendzevutani -->
- <link href = "xitsonga/css/bootstrap.min.css" rel = "xiphephana xa xitayili" >
- <!-- Phurojeke -->
- <link href = "public/css/xitirhisiwa.css" rel = "xiphephana xa xitayili" >
- </head>
- <miri>
- <h1> Xewani, misava! </h1>
- <!-- Xirhendzevutani xa xirhendzevutani -->
- <script src = "xitshuriwa xa mani na mani/js/bootstrap.min.js" ></script>
- <!-- Phurojeke -->
- <script src = "xitirhisiwa xa mani na mani/js/xitirhisiwa.js" ></script>
- </body>
- </html>