-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_eleventy.sh
More file actions
executable file
Β·156 lines (132 loc) Β· 2.93 KB
/
Copy pathsetup_eleventy.sh
File metadata and controls
executable file
Β·156 lines (132 loc) Β· 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/bin/bash
# === Project Initialization ===
echo "π Initializing Eleventy Project in the current directory..."
npm init -y
npm install @11ty/eleventy gh-pages --save-dev
# === Directory Structure ===
echo "π Creating directory structure..."
mkdir -p src/_includes
mkdir -p src/css
# === Layout Files ===
echo "π Creating layout files..."
cat <<EOL > src/_includes/base.njk
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ title }}</title>
<link rel="stylesheet" href="/css/main.css">
</head>
<body>
<header>
<h1>{{ title }}</h1>
</header>
<main>
{% block content %}{% endblock %}
</main>
</body>
</html>
EOL
cat <<EOL > src/_includes/post.njk
{% extends "base.njk" %}
{% block content %}
<article>
<h1>{{ title }}</h1>
<p>{{ content | safe }}</p>
</article>
{% endblock %}
EOL
# === Content Files ===
echo "π Creating content files..."
cat <<EOL > src/index.md
---
layout: "base.njk"
title: "Welcome to My Portfolio"
---
# Hello, I'm Pablo Freitas
A data scientist passionate about solving real-world problems using data-driven insights.
Explore my [About Page](/about) to learn more about me.
EOL
cat <<EOL > src/about.md
---
layout: "post.njk"
title: "About Me"
permalink: /about/
---
Hello, Iβm Pablo Freitas, a data scientist passionate about solving real-world problems using data-driven insights.
EOL
# === CSS File ===
echo "π¨ Creating CSS file..."
cat <<EOL > src/css/main.css
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 0;
background-color: #f9f9f9;
}
header {
background: #333;
color: #fff;
text-align: center;
padding: 1rem 0;
}
main {
padding: 2rem;
max-width: 800px;
margin: 0 auto;
background-color: white;
border-radius: 8px;
}
EOL
# === Eleventy Configuration ===
echo "βοΈ Creating Eleventy configuration..."
cat <<EOL > .eleventy.js
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("src/css");
return {
dir: {
input: "src",
includes: "_includes",
output: "_site"
}
};
};
EOL
# === Git Ignore ===
echo "π« Creating .gitignore..."
cat <<EOL > .gitignore
# Eleventy output folder
_site/
# Node modules
node_modules/
# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Optional npm cache directory
.npm/
# Local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# Eleventy cache
.cache/
# MacOS specific files
.DS_Store
# IDE specific files
.idea/
.vscode/
*.swp
EOL
# === Package JSON Scripts ===
echo "π Adding build and deploy scripts to package.json..."
npx npm-add-script -k "build" -v "eleventy"
npx npm-add-script -k "start" -v "eleventy --serve"
npx npm-add-script -k "deploy" -v "npm run build && gh-pages -d _site"
# === Done ===
echo "β
Eleventy project setup is complete!"
echo "π Run the project with: npm start"
echo "π Visit: http://localhost:8080"