Skip to content

Commit 89233cd

Browse files
init new project
Signed-off-by: Timi <treasurealekhojie@yahoo.com>
0 parents  commit 89233cd

12 files changed

Lines changed: 3196 additions & 0 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# HTML Tailwind
2+
3+
## Overview
4+
5+
**HTML Tailwind** is a simple boilerplate designed to help you quickly set up a project using HTML and Tailwind CSS. Whether you're a seasoned developer or just starting out, this boilerplate provides a streamlined foundation, allowing you to focus on building your application without the hassle of initial configuration.
6+
7+
## Features
8+
9+
- **Quick Setup**: Get started in minutes with a pre-configured structure.
10+
- **Tailwind CSS Integration**: Utilize the power of Tailwind CSS for rapid UI development.
11+
- **Responsive Design**: Built-in responsiveness to ensure your project looks great on all devices.
12+
- **Customizable**: Easily modify the configuration to suit your project needs.
13+
14+
## Getting Started
15+
16+
Follow these steps to set up your HTML Tailwind project:
17+
18+
### Prerequisites
19+
20+
- [Node.js](https://nodejs.org/) (version 14 or higher)
21+
- A code editor (such as [Visual Studio Code](https://code.visualstudio.com/))
22+
23+
### Installation
24+
25+
1. **Clone the repository**:
26+
27+
```bash
28+
git clone https://github.com/creative-tutorials/html-tailwind.git
29+
cd html-tailwind
30+
```
31+
32+
2. **Install dependencies**:
33+
34+
```bash
35+
pnpm install
36+
```
37+
38+
3. **Start the development server**:
39+
40+
```bash
41+
pnpm run dev
42+
```
43+
44+
4. **Open your browser** and navigate to `http://localhost:4000` to see your project in action!
45+
46+
## Usage
47+
48+
You can start editing the `index.html` file to customize your project. Tailwind CSS classes can be added directly to your HTML elements to style them as needed. For more information on using Tailwind CSS, check out the [Tailwind CSS Documentation](https://tailwindcss.com/docs).
49+
50+
## Customization
51+
52+
To customize your Tailwind configuration, edit the `tailwind.config.js` file.
53+
54+
## Contributing
55+
56+
Contributions are welcome! If you have suggestions for improvements or want to add features. To get started, fork the repository and submit a pull request.
57+
58+
### Steps to Contribute
59+
60+
1. Fork the repository.
61+
2. Create a new branch (`git checkout -b feature/YourFeature`).
62+
3. Make your changes and commit them (`git commit -m 'Add some feature'`).
63+
4. Push to the branch (`git push origin feature/YourFeature`).
64+
5. Open a pull request.
65+
66+
## License
67+
68+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
69+
70+
## Acknowledgments
71+
72+
- [Tailwind CSS](https://tailwindcss.com/) for providing an amazing utility-first CSS framework.
73+
- [HTML5](https://www.w3.org/TR/html52/) for a solid foundation for web development.
74+
75+
## Contact
76+
77+
For questions or feedback, feel free to reach out via [GitHub Issues](https://github.com/creative-tutorials/html-tailwind/issues) or directly at [hellotimi](mailto:hellotimi@proton.me)

bs-config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
proxy: "http://localhost:5300", // Your server's address
3+
files: ["src/**/*.html", "src/**/*.css"], // Files to watch
4+
port: 4000, // Port for Browser-Sync
5+
reloadDelay: 500, // Delay to ensure the server restarts before reloading
6+
open: false, // Prevents Browser-Sync from opening a new tab on start
7+
};

lib/utils.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { clsx } from "clsx";
2+
import { twMerge } from "tailwind-merge";
3+
4+
export function cn(...inputs) {
5+
return twMerge(clsx(inputs));
6+
}

main.mjs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { createServer } from "node:http";
2+
import { readFile, stat } from "node:fs";
3+
import { join, dirname, extname } from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
6+
// Get the current directory name
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = dirname(__filename);
9+
10+
// Define the path to the index.html file
11+
const filePath = join(__dirname, "src", "index.html");
12+
13+
// Create the server
14+
const server = createServer((req, res) => {
15+
// Handle requests for the root path
16+
if (req.url === "/") {
17+
readFile(filePath, (err, data) => {
18+
if (err) {
19+
res.writeHead(500, { "Content-Type": "text/plain" });
20+
res.end("Internal Server Error");
21+
} else {
22+
res.writeHead(200, { "Content-Type": "text/html" });
23+
res.end(data);
24+
}
25+
});
26+
} else {
27+
// Serve static files (like CSS)
28+
const fileUrl = join(__dirname, "src", req.url);
29+
stat(fileUrl, (err) => {
30+
if (err) {
31+
// If the file doesn't exist, send a 404 Not Found response
32+
res.writeHead(404, { "Content-Type": "text/plain" });
33+
res.end("Not Found");
34+
} else {
35+
// Read the requested file
36+
readFile(fileUrl, (err, data) => {
37+
if (err) {
38+
res.writeHead(500, { "Content-Type": "text/plain" });
39+
res.end("Internal Server Error");
40+
} else {
41+
// Determine the content type based on the file extension
42+
const ext = extname(req.url);
43+
let contentType = "text/plain";
44+
switch (ext) {
45+
case ".css":
46+
contentType = "text/css";
47+
break;
48+
case ".js":
49+
contentType = "application/javascript";
50+
break;
51+
case ".png":
52+
contentType = "image/png";
53+
break;
54+
case ".jpg":
55+
contentType = "image/jpeg";
56+
break;
57+
case ".gif":
58+
contentType = "image/gif";
59+
break;
60+
case ".svg":
61+
contentType = "image/svg+xml";
62+
break;
63+
case ".html":
64+
contentType = "text/html";
65+
break;
66+
}
67+
// Send the file contents with a 200 OK status
68+
res.writeHead(200, { "Content-Type": contentType });
69+
res.end(data);
70+
}
71+
});
72+
}
73+
});
74+
}
75+
});
76+
77+
// Start the server on port 5300
78+
server.listen(5300, () => {
79+
console.log("Server is running on http://localhost:5300");
80+
});

package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "html-tailwind",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"dev": "concurrently \"pnpm run build\" \"pnpm run serve\" \"pnpm run sync\"",
8+
"serve": "nodemon main.mjs",
9+
"sync": "browser-sync start --config bs-config.js",
10+
"build": "tailwindcss -i ./src/styles.css -o ./src/output.css --watch"
11+
},
12+
"keywords": [],
13+
"author": "",
14+
"license": "ISC",
15+
"devDependencies": {
16+
"autoprefixer": "^10.4.20",
17+
"browser-sync": "^3.0.2",
18+
"concurrently": "^8.2.2",
19+
"nodemon": "^3.1.4",
20+
"postcss": "^8.4.41",
21+
"postcss-cli": "^11.0.0",
22+
"tailwindcss": "^3.4.7"
23+
},
24+
"dependencies": {
25+
"@radix-ui/react-icons": "^1.3.0",
26+
"class-variance-authority": "^0.7.0",
27+
"clsx": "^2.1.1",
28+
"lucide-react": "^0.424.0",
29+
"tailwind-merge": "^2.4.0",
30+
"tailwindcss-animate": "^1.0.7"
31+
}
32+
}

0 commit comments

Comments
 (0)