You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64-41Lines changed: 64 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,77 +43,57 @@ Example:
43
43
44
44
This will set up your project with the chosen theme and ensure **fast loading speeds** via CDN resources.
45
45
46
-
### 3. Add Components
46
+
### 3. Serve Your Site for Development
47
47
48
-
To add pre-built, **pagespeed-optimized components** (such as a navigation bar or footer), navigate to your project directory:
48
+
First, navigate to your project directory:
49
49
50
50
```bash
51
51
cd ./projects/my-awesome-site
52
52
```
53
53
54
-
Then run the following command to list all available MiniTemplate-Components that utilize **daisyUI**-Comnponents as HTML base. See [here](https://daisyui.com/components/button/):
54
+
Then, to start the development server and preview your project, run:
55
55
56
56
```bash
57
-
./run_add.sh
57
+
./run_serve.sh
58
58
```
59
59
60
-
You can choose between adding a template, a component or default components like sidebar, header, footer and navigation.
60
+
You can now visit your site at [http://localhost:8000](http://localhost:8000) to view the served index.html.
61
61
62
-
```bash
63
-
./run_add.sh [defaults|component|template]
64
-
```
62
+
### 4. Add a Component
65
63
66
-
Example:
64
+
To customize your site, you can add components. Let’s add a button component to your project:
67
65
68
-
Add a Button to your project (button.html):
69
-
```bash
70
-
./run_add.sh button
71
-
```
72
-
Add a the default template file (template_default.html):
73
66
```bash
74
-
./run_add.sh template_default.html
75
-
```
76
-
Adds a set of default components like header, footer, sidebar and default template:
77
-
```bash
78
-
./run_add.sh defaults
67
+
./scripts/run_add.sh button
79
68
```
80
69
81
-
### 4. Generate the Site
70
+
This command will generate a new `button.html` file in your project’s components folder. Now, you can use this component inside your template.
82
71
83
-
After adding components, generate the static HTML files using:
72
+
### 5. Insert the Component in the Template
84
73
85
-
```bash
86
-
./run_generate.sh
87
-
```
74
+
Open the `template_default.html` file located in your project’s templates folder. To include the newly added button component, find a suitable place within the template and add the following placeholder:
88
75
89
-
This will create or update the `index.html` file, with all components integrated.
76
+
```html
77
+
{{button}}
78
+
```
90
79
91
-
### 5. Print the Site Structure
80
+
### 6. Print the Updated Template
92
81
93
-
For a quick overview of your site structure, use the print command:
82
+
You can print the updated template structure to verify your changes:
94
83
95
84
```bash
96
-
./print.sh
85
+
./scripts/print.sh
97
86
```
98
87
99
-
### 6. Test Your Setup
88
+
### 7. Re-generate the Site
100
89
101
-
To ensure everything is functioning properly, run the test scripts:
90
+
After adding the component and updating the template, you need to re-create the index.html file to reflect your changes:
102
91
103
92
```bash
104
-
bash run_tests.sh
105
-
```
106
-
107
-
#### Example Output
108
-
109
-
```
110
-
✔ Test passed: run_create_project.sh ran successfully.
111
-
✔ Component 'navbar' added to 'my-awesome-site'.
112
-
✔ Template generation test passed: 'index.html' created with the selected theme.
113
-
✔ All tests passed successfully.
93
+
./scripts/run_generate.sh
114
94
```
115
95
116
-
Run these tests to validate that all components, templates, and scripts are working as intended.
96
+
This will regenerate the `index.html` file with the newly integrated button component.
117
97
118
98
## Example Pre-Created Project Structure
119
99
@@ -182,6 +162,49 @@ To further optimize your MiniTemplate project for production, you can follow the
182
162
183
163
By using PurgeCSS and enabling Tailwind JIT mode directly from the CDN, you can significantly reduce your CSS file size and boost your site's performance without needing any additional tools or setups.
184
164
165
+
## Testing Your Site
166
+
167
+
MiniTemplate provides built-in test scripts to verify the integrity and functionality of your site. Running the following command will initiate the test suite:
168
+
169
+
```bash
170
+
bash run_tests.sh
171
+
```
172
+
173
+
#### Example Output
174
+
175
+
```
176
+
✔ Test passed: run_create_project.sh ran successfully.
177
+
✔ Component 'navbar' added to 'my-awesome-site'.
178
+
✔ Template generation test passed: 'index.html' created with the selected theme.
179
+
✔ All tests passed successfully.
180
+
```
181
+
182
+
## Component Structure
183
+
184
+
MiniTemplate’s components are modular, with **auto-generated IDs**, **scoped CSS**, and **collision-free JavaScript**. Here’s an example of how a component is structured, showcasing the best practices for performance and maintainability:
-**Scoped CSS** ensures that styles don't leak into other components.
205
+
-**Collision-free JavaScript** using an Immediately Invoked Function Expression (IIFE) for encapsulation.
206
+
-**Embedded Script** for optional state management, adding flexibility.
207
+
185
208
## Contribute
186
209
187
210
We welcome contributions from the community! If you’d like to contribute, please check the [CONTRIBUTING.md](./CONTRIBUTING.md) file for details on how to get started.
0 commit comments