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
+48-12Lines changed: 48 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,7 @@
11
11
<template>
12
12
<divclass="page">{{msg}}</div>
13
13
<!-- Inline partials -->
14
-
{{> 'foo'}}
15
-
{{> 'bar'}}
14
+
{{> 'foo'}} {{> 'bar'}}
16
15
<!-- External partials -->
17
16
{{> 'external'}}
18
17
</template>
@@ -26,16 +25,18 @@
26
25
</template-partial>
27
26
28
27
<script>
29
-
exportdefault {
30
-
data() {
31
-
return {
32
-
msg:'Hello world!'
33
-
}
34
-
}
35
-
}
28
+
exportdefault {
29
+
data() {
30
+
return {
31
+
msg:'Hello world!',
32
+
};
33
+
},
34
+
};
36
35
</script>
37
36
```
37
+
38
38
#### External partial templates example (see config for location)
39
+
39
40
```html
40
41
<!-- external.f7p.html -->
41
42
<template>
@@ -64,9 +65,14 @@ module.exports = {
64
65
{
65
66
loader:'framework7-component-loader',
66
67
options: {
68
+
// path to file that exports array of Template7 helpers names
67
69
helpersPath:'./src/template7-helpers-list.js',
70
+
// path where to look for Template7 partials
68
71
partialsPath:'./src/pages/',
69
-
partialsExt:'.f7p.html'
72
+
// Template7 partials file extension
73
+
partialsExt:'.f7p.html',
74
+
// When enabled it will minify templates HTML content
75
+
minifyTemplate:true,
70
76
}
71
77
}
72
78
],
@@ -79,6 +85,36 @@ module.exports = {
79
85
}
80
86
```
81
87
82
-
## Framework7 Webpack Template
88
+
## Template7 Helpers
83
89
84
-
There is already ready to use [Framework7 Webpack Template](https://github.com/framework7io/framework7-template-webpack) pre-configured with `framework7-component-loader`
90
+
To use Template7 helpers, we need to specify helpers names in separate file and specify path to file in `helpersPath` loader parameter. It is required because template is compiled on server side which doesn't know about helpers registered during app runtime.
91
+
92
+
So, if we use helpers named `foo` and `bar` in our templates, we need to register their names in file:
93
+
94
+
```js
95
+
/* src/template7-helpers-list.js */
96
+
module.exports= ['foo', 'bar'];
97
+
```
98
+
99
+
And specify this file in loader options:
100
+
101
+
```js
102
+
rules: [
103
+
...
104
+
{
105
+
test:/\.f7.html$/,
106
+
use: [
107
+
'babel-loader',
108
+
{
109
+
loader:'framework7-component-loader',
110
+
options: {
111
+
// path to file that exports array of Template7 helpers names
0 commit comments