33
loading...
This website collects cookies to deliver better user experience
npx create-remix@latest
taco-it_remix
and chose Vercel hosting. I also allowed remix to run npm install so our base Remix site will be functional.
/app/
folder (/src/Components
& /src/Images
) to (/taco-it_remix/app/Components
& /taco-it_remix/app/Images
).gitignore
file and copy contents into /taco-it_remix/.gitignore
filestyles
folder under /taco-it_remix/app/styles
and copied (/taco-it_remix/app/Components/WallPaper.css
) into /taco-it_remix/app/styles/WallPaper.css
. npm install
to install all my dependenciesnpm install -D tailwindcss
npm install concurrently
npx tailwindcss init
tailwind.config.js
file in our application for their purge function for any javascript .js
or .jsx
file.module.exports = {
purge: ["./app/**/*.{js,jsx}"], // Here we are going to tell Tailwind to use any javascript .js or .jsx file
theme: { extend: {
} },
variants: {},
plugins: [],
};
package.json
file with scripts to generate our tailwind.css file. package.json
scripts section to match this"scripts": {
"build": "npm run build:css && remix build",
"build:css": "tailwindcss -o ./app/tailwind.css",
"dev": "concurrently \"npm run dev:css\" \"remix dev\"",
"dev:css": "tailwindcss -o ./app/tailwind.css --watch",
"postinstall": "remix setup node",
"start": "remix-serve build"
},
npm run dev
it will generate a tailwind.css file in the root of our /app/ folder. We need to tell Remix that we can to use this style sheet. I'm going to set this up in our Root file so that TailwindCSS styles are imported to the entire site. Remix does this by importing our styles and using their links function to apply the stylesheet to the head of the HTML file. root.jsx
file under (/app
)import tailwindstyles from "./tailwind.css";
export let links = () => {
return [
{ rel: "stylesheet", href: tailwindstyles }
];
};
index.js
in the root of the src
directory. In Remix, we are going to use our /app/routes/index.jsx
file to render our home page. I'm going to import my HomePage.js component into my Remix index.jsx file which will render all of my sub-components. This index file is rendered after our Root.jsx file so it will house all of our root route ('/')
data. import HomePage from "~/Components/HomePage";
export default function Index() {
return (
<>
<HomePage />
</>
);
}
import HomePage from "~/Components/HomePage";
import WallPaper from "~/Components/WallPaper"
import WallPaperStyles from '~/styles/WallPaper.css'
export const links = () => {
return [
{
rel: "stylesheet",
href: WallPaperStyles
},
]
}
export default function Index() {
return (
<>
<WallPaper />
<HomePage />
</>
);
}
npm run dev
and be presented with our site. npx create-remix@latest
, I copied our existing React code to the correct locations, we setup TailwindCSS for Remix, and updated our Index.jsx file to render our HomePage component and now the site is working. Run npm run dev
and verify site functionality. Once it was working, I pushed to Github for site generation.