fast-ejs-builder 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -21
- package/bin/index.js +0 -0
- package/fast.ejs.json +3 -3
- package/fast.ejs.schema.json +3 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -44,10 +44,9 @@ npm install fast-ejs-builder --save-dev
|
|
|
44
44
|
|
|
45
45
|
```txt
|
|
46
46
|
my-site/
|
|
47
|
-
├──
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
│ └── pages/ # EJS templates
|
|
47
|
+
├── components/ # Reusable EJS components
|
|
48
|
+
├── data/ # Global and local data files
|
|
49
|
+
└── pages/ # EJS templates
|
|
51
50
|
│ └── public/ # Static assets
|
|
52
51
|
└── fast.ejs.json # Configuration file
|
|
53
52
|
```
|
|
@@ -62,14 +61,14 @@ npm install fast-ejs-builder --save-dev
|
|
|
62
61
|
"useIndexRouting": true
|
|
63
62
|
},
|
|
64
63
|
"components": {
|
|
65
|
-
"dir": "
|
|
64
|
+
"dir": "components"
|
|
66
65
|
},
|
|
67
66
|
"data": {
|
|
68
|
-
"dir": "
|
|
67
|
+
"dir": "data",
|
|
69
68
|
"allow": "all"
|
|
70
69
|
},
|
|
71
70
|
"pages": {
|
|
72
|
-
"dir": "
|
|
71
|
+
"dir": "pages"
|
|
73
72
|
},
|
|
74
73
|
"tailwind": {
|
|
75
74
|
"output": "public/app.css",
|
|
@@ -128,14 +127,14 @@ The `fast.ejs.json` (occasionnally called _the FEJ_) file controls all aspects o
|
|
|
128
127
|
"useIndexRouting": true
|
|
129
128
|
},
|
|
130
129
|
"components": {
|
|
131
|
-
"dir": "
|
|
130
|
+
"dir": "components"
|
|
132
131
|
},
|
|
133
132
|
"data": {
|
|
134
|
-
"dir": "
|
|
133
|
+
"dir": "data",
|
|
135
134
|
"allow": "all"
|
|
136
135
|
},
|
|
137
136
|
"pages": {
|
|
138
|
-
"dir": "
|
|
137
|
+
"dir": "pages"
|
|
139
138
|
},
|
|
140
139
|
"tailwind": {
|
|
141
140
|
"output": "public/app.css",
|
|
@@ -165,7 +164,7 @@ The `fast.ejs.json` (occasionnally called _the FEJ_) file controls all aspects o
|
|
|
165
164
|
Create EJS templates in your `pages.dir` directory:
|
|
166
165
|
|
|
167
166
|
```ejs
|
|
168
|
-
<!--
|
|
167
|
+
<!-- pages/index.ejs -->
|
|
169
168
|
<!DOCTYPE html>
|
|
170
169
|
<html lang="en">
|
|
171
170
|
<head>
|
|
@@ -193,7 +192,7 @@ Create EJS templates in your `pages.dir` directory:
|
|
|
193
192
|
Create reusable components in your `components.dir`:
|
|
194
193
|
|
|
195
194
|
```ejs
|
|
196
|
-
<!--
|
|
195
|
+
<!-- components/header.ejs -->
|
|
197
196
|
<header class="bg-white shadow-sm">
|
|
198
197
|
<nav class="container mx-auto px-4 py-4">
|
|
199
198
|
<div class="flex items-center justify-between">
|
|
@@ -243,7 +242,7 @@ Fast EJS comes with default data that can't be overrided.
|
|
|
243
242
|
In the previous example, we can access `"https://placehold.co/400"` by using `$0` (`0` for the first arg).
|
|
244
243
|
|
|
245
244
|
```ejs
|
|
246
|
-
<!--
|
|
245
|
+
<!--components/users/avatar.ejs-->
|
|
247
246
|
<img src="<%= $0 %>" class="w-10 aspect-square rounded-full"/>
|
|
248
247
|
```
|
|
249
248
|
|
|
@@ -258,15 +257,15 @@ Fast EJS comes with default data that can't be overrided.
|
|
|
258
257
|
Returns the current route relative to the `pages.dir`. In this example, it will return `/home`
|
|
259
258
|
|
|
260
259
|
```ejs
|
|
261
|
-
<!--
|
|
260
|
+
<!--pages/home.ejs-->
|
|
262
261
|
<%= $route %>
|
|
263
262
|
```
|
|
264
263
|
|
|
265
264
|
- `$css` :\
|
|
266
265
|
Automatically imports the relative path of generated tailwind css from `tailwind.output` inside a page. No need to manually write the css path and change everytime.\
|
|
267
266
|
\
|
|
268
|
-
For example, inside `
|
|
269
|
-
while inside `
|
|
267
|
+
For example, inside `pages/users/profile.ejs`, it can return something like `../../public/app.css`\
|
|
268
|
+
while inside `pages/index.ejs`, it will return something like `./public/app.css`
|
|
270
269
|
|
|
271
270
|
```ejs
|
|
272
271
|
<%- $css %>
|
|
@@ -306,7 +305,7 @@ Fast EJS comes with default data that can't be overrided.
|
|
|
306
305
|
Prints anything in the console during build. Use it to debug your pages or components
|
|
307
306
|
|
|
308
307
|
```ejs
|
|
309
|
-
<!--
|
|
308
|
+
<!--components/header.ejs-->
|
|
310
309
|
<%- $debug("Header component says hi !") %>
|
|
311
310
|
```
|
|
312
311
|
|
|
@@ -326,7 +325,7 @@ Fill data files in `data.dir` (generated automatically if missing).
|
|
|
326
325
|
If `data.allow` is `all` or `js` (recommended)
|
|
327
326
|
|
|
328
327
|
```javascript
|
|
329
|
-
//
|
|
328
|
+
// data/global.data.js
|
|
330
329
|
module.exports = {
|
|
331
330
|
siteName: "My Awesome Site",
|
|
332
331
|
navItems: [
|
|
@@ -342,7 +341,7 @@ module.exports = {
|
|
|
342
341
|
If `data.allow` is `all` or `json`
|
|
343
342
|
|
|
344
343
|
```js
|
|
345
|
-
//
|
|
344
|
+
// data/global.data.json
|
|
346
345
|
{
|
|
347
346
|
"siteName": "My Awesome Site",
|
|
348
347
|
"navItems": [
|
|
@@ -356,9 +355,9 @@ If `data.allow` is `all` or `json`
|
|
|
356
355
|
- **Local data** : Can be accessed only in the target page
|
|
357
356
|
|
|
358
357
|
```javascript
|
|
359
|
-
//
|
|
358
|
+
// data/local.data.js
|
|
360
359
|
module.exports = {
|
|
361
|
-
// for page "
|
|
360
|
+
// for page "pages/users/profile.ejs"
|
|
362
361
|
"users/profile": {
|
|
363
362
|
title: "Welcome to My Site",
|
|
364
363
|
description: "This is a fast-ejs powered website with Tailwind CSS.",
|
package/bin/index.js
CHANGED
|
File without changes
|
package/fast.ejs.json
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
"useIndexRouting": true
|
|
7
7
|
},
|
|
8
8
|
"components": {
|
|
9
|
-
"dir": "
|
|
9
|
+
"dir": "components"
|
|
10
10
|
},
|
|
11
11
|
"data": {
|
|
12
12
|
"allow": "all",
|
|
13
|
-
"dir": "
|
|
13
|
+
"dir": "data"
|
|
14
14
|
},
|
|
15
15
|
"pages": {
|
|
16
|
-
"dir": "
|
|
16
|
+
"dir": "pages"
|
|
17
17
|
},
|
|
18
18
|
"tailwind": {
|
|
19
19
|
"imports": [],
|
package/fast.ejs.schema.json
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"components": {
|
|
32
32
|
"properties": {
|
|
33
33
|
"dir": {
|
|
34
|
-
"default": "
|
|
34
|
+
"default": "components",
|
|
35
35
|
"description": "The folder containing your EJS components",
|
|
36
36
|
"type": "string"
|
|
37
37
|
}
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"data": {
|
|
43
43
|
"properties": {
|
|
44
44
|
"dir": {
|
|
45
|
-
"default": "
|
|
45
|
+
"default": "data",
|
|
46
46
|
"description": "The folder containing global and local data files (global.data.js/json, local.data.js/json)",
|
|
47
47
|
"type": "string"
|
|
48
48
|
},
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"pages": {
|
|
61
61
|
"properties": {
|
|
62
62
|
"dir": {
|
|
63
|
-
"default": "
|
|
63
|
+
"default": "pages",
|
|
64
64
|
"description": "The folder containing your EJS templates",
|
|
65
65
|
"type": "string"
|
|
66
66
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fast-ejs-builder",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Fast-EJS is a simple and fast tool to pre-render EJS templates into static HTML files with clean conventions and flexible data handling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tailwind",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"bin": {
|
|
28
28
|
"fast-ejs": "bin/index.js"
|
|
29
29
|
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
32
|
+
"dev": "nodemon index.js"
|
|
33
|
+
},
|
|
30
34
|
"dependencies": {
|
|
31
35
|
"@inquirer/prompts": "^8.2.0",
|
|
32
36
|
"autoprefixer": "^10.4.23",
|
|
@@ -36,9 +40,5 @@
|
|
|
36
40
|
"postcss": "^8.5.6",
|
|
37
41
|
"prettier": "^3.8.0",
|
|
38
42
|
"tailwindcss": "^3.4.17"
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
42
|
-
"dev": "nodemon index.js"
|
|
43
43
|
}
|
|
44
|
-
}
|
|
44
|
+
}
|