vite-file-include 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 +1 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,8 +34,7 @@ export default {
|
|
|
34
34
|
loopPattern: "@@loop",
|
|
35
35
|
ifPattern: "@@if",
|
|
36
36
|
baseDir: process.cwd(),
|
|
37
|
-
context: {},
|
|
38
|
-
customFunctions: {},
|
|
37
|
+
context: {},
|
|
39
38
|
cacheTimeout: 5000
|
|
40
39
|
}),
|
|
41
40
|
],
|
|
@@ -49,7 +48,6 @@ export default {
|
|
|
49
48
|
- `ifPattern` (default: `@@if`): The pattern used to conditionally render content.
|
|
50
49
|
- `baseDir` (default: `process.cwd()`): The base directory for resolving paths.
|
|
51
50
|
- `context` (default: `{}`): An object containing global variables that can be used in includes, loops, and conditionals.
|
|
52
|
-
- `customFunctions` (default: `{}`): An object containing custom functions that can be used in expressions.
|
|
53
51
|
- `cacheTimeout` (default: `5000`): The time (in milliseconds) after which cached content is invalidated.
|
|
54
52
|
|
|
55
53
|
## Directives
|
|
@@ -120,25 +118,6 @@ The `@@if` directive allows conditional rendering based on an expression.
|
|
|
120
118
|
}
|
|
121
119
|
```
|
|
122
120
|
|
|
123
|
-
## Custom Functions
|
|
124
|
-
|
|
125
|
-
You can define custom functions to use in your templates. These functions are passed to the plugin through the `customFunctions` option:
|
|
126
|
-
|
|
127
|
-
```javascript
|
|
128
|
-
fileIncludePlugin({
|
|
129
|
-
customFunctions: {
|
|
130
|
-
uppercase: (str) => str.toUpperCase(),
|
|
131
|
-
currentYear: () => new Date().getFullYear()
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
You can then use these functions in your templates:
|
|
137
|
-
|
|
138
|
-
```html
|
|
139
|
-
<p>{{ uppercase(name) }}</p>
|
|
140
|
-
<footer>© {{ currentYear() }}</footer>
|
|
141
|
-
```
|
|
142
121
|
|
|
143
122
|
## Example Usage
|
|
144
123
|
|