Yin amfani da ilimin ฦwararrun mu, za mu iya fara labarin kamar haka:
NextJS sanannen tsari ne a cikin tsarin muhallin JavaScript saboda ฦarfin aikinsa da abubuwan haษaka kayan aiki. Haษe tare da Tailwind CSS, tsarin CSS na farko mai amfani, yana ba da tushe mai ฦarfi da sassauฦa don gina aikace-aikacen yanar gizo na zamani, ingantaccen inganci. Abin da ya fi dacewa shi ne dacewarsa tare da Typescript, wanda ke ba masu haษaka damar yin amfani da fa'idodi kamar buga rubutu a tsaye da yuwuwar gano kurakuran lokacin aiki.
Ta hanyar NextJS da Tailwind CSS, Masu haษakawa na iya kawo ra'ayoyin su zuwa rayuwa da inganci, suna ษaukar yawan aiki zuwa mataki na gaba. Tare, waษannan kayan aikin masu ฦarfi suna haifar da tsabta, daษaษษa da ingantattun mu'amalar mai amfani.
Gabatarwar Matsala
Yawancin lokaci, masu haษakawa suna fuskantar ฦalubalen kafa NextJS tare da Rubutun Rubutun da Tailwind CSS. Wannan tsari yana buฦatar fahimtar ฦididdiga daban-daban da daidaitawa. Koyaya, ka tabbata saboda mun samar da mafita mataki-mataki ga wannan matsala a cikin sakin layi na gaba, ta haka ne. sauฦaฦe muku wannan tsari.
// Basic imports import React from 'react'; import styled from 'styled-components'; const StyledDiv = styled.div` /* your styles here */ `; class MyStyledComponent extends React.Component { render() { return <StyledDiv> /* your code here */ </StyledDiv> } } export default MyStyledComponent;
Mataki-mataki Neman Magani
Don daidaita tsarin saitin, yana da amfani a raba shi zuwa matakai masu iya sarrafawa.
Mataki 1: Fara da ฦaddamar da sabon aikin NextJS:
npx create-next-app my-app cd my-app
Mataki 2: Saita Rubutun Rubutun:
npm install --save typescript touch tsconfig.json
Gudanar da uwar garken haษakawa tare da 'npm run dev'. NextJS zai saita fayil ษin 'tsconfig.json' ta atomatik ta atomatik.
Game da ฦara Tailwind CSS zuwa NextJS, akwai hanyoyi guda biyu masu yiwuwa - shigar da shi da hannu ko amfani da plugin. Don aiwatarwa kai tsaye, muna ba da shawarar hanyar plugin.
Haษa Tailwind CSS tare da NextJS
Idan kuna canzawa daga saitin abubuwan da aka tsara ko kuma kawai kuna son haษa Tailwind CSS tare da NextJS, wannan sashin zai jagorance ku ta hanyar:
npm install tailwindcss @fullhuman/postcss-purgecss postcss-preset-env npx tailwind init tailwind.config.js --full
Na gaba, saita PostCSS don amfani da Tailwind CSS da PurgeCSS, wanda ke inganta girman nauyin biya na ฦarshe yadda ya kamata. A ฦarshe, kar a manta ku haษa CSS na Tailwind a cikin salon ku na duniya.
Muhimman Dakunan karatu da Ayyuka
Dukansu NextJS da Tailwind CSS suna kawo ษakunan karatu da ayyuka da yawa don daidaita tsarin haษaka ku. Fitattun su ne 'styled-jsx' ษakin karatu na NextJS wanda ke ba da damar yin salo da yawa da kuma '@apply' aiki daga Tailwind CSS don tsara hadaddun bayyanuwa.
Buga haษawar Tailwind CSS tare da NextJS, ฦa'idodin gidan yanar gizon ku ya zama a shirye don haษaka kayan aikin. Wannan haษe-haษe, wanda aka tara tare da Typescript, yana haษaka tsarin haษaka ku sosai yayin sa aikace-aikacenku ya zama mai inganci da kiyayewa. Duk da haka, mabuษin yin amfani da waษannan kayan aikin yadda ya kamata ya ta'allaka ne cikin fahimtar amfani da su wajen haษaka na zamani, aikace-aikacen yanar gizo na abokantaka na SEO. Wannan shine inda ainihin kyawun NextJS, Tailwind CSS, da Nau'in Rubutun ya buษe.
Binciken da ke sama yana jagorantar ku akan kafa NextJS, Rubutun rubutu, da muhallin Tailwind CSS, kuma muna fatan ya gabatar da taswirar hanya mai mahimmanci a cikin tafiyar ci gaban yanar gizon ku.