Skip to content

Commit 6ffc1ee

Browse files
committed
3.0.0-beta.1 release
1 parent 87fda26 commit 6ffc1ee

File tree

3 files changed

+33
-77
lines changed

3 files changed

+33
-77
lines changed

README.md

Lines changed: 26 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,30 @@
11
# Framework7 Component Loader
22

3-
> Webpack loader for Framework7 single file router components
3+
> Webpack loader for Framework7 single file components
44
55
## What is Framework7 Component Loader?
66

7-
`framework7-component-loader` is a loader for [webpack](https://webpack.js.org/) that allows you to author [Framework7 Router components](http://framework7.io/docs/router-component.html) in a format called [Single-File Components](http://framework7.io/docs/router-component.html#single-file-component):
7+
`framework7-loader` is a loader for [webpack](https://webpack.js.org/) that allows you to author [Framework7 Router components](http://framework7.io/docs/router-component.html) in a format called [Single-File Components](http://framework7.io/docs/router-component.html#single-file-component):
88

99
```html
1010
<!-- my-page.f7.html -->
1111
<template>
12-
<div class="page">{{msg}}</div>
13-
<!-- Inline partials -->
14-
{{> 'foo'}} {{> 'bar'}}
15-
<!-- External partials -->
16-
{{> 'external'}}
12+
<div class="page">${msg}</div>
1713
</template>
1814

19-
<!-- Template7 inline partial support (optional) -->
20-
<template-partial id="foo">
21-
<div>foo</div>
22-
</template-partial>
23-
<template-partial id="bar">
24-
<div>bar</div>
25-
</template-partial>
26-
2715
<script>
28-
export default {
29-
data() {
30-
return {
31-
msg: 'Hello world!',
32-
};
33-
},
16+
export default () => {
17+
const msg = 'Hello world';
18+
19+
return $render;
3420
};
3521
</script>
3622
```
3723

38-
#### External partial templates example (see config for location)
39-
40-
```html
41-
<!-- external.f7p.html -->
42-
<template>
43-
<div>External template get scope context {{msg}}</div>
44-
</template>
45-
```
46-
4724
## Installation
4825

4926
```
50-
npm i framework7-component-loader
27+
npm i framework7-loader
5128
```
5229

5330
## Configuration
@@ -62,19 +39,7 @@ module.exports = {
6239
test: /\.f7.html$/,
6340
use: [
6441
'babel-loader',
65-
{
66-
loader: 'framework7-component-loader',
67-
options: {
68-
// path to file that exports array of Template7 helpers names
69-
helpersPath: './src/template7-helpers-list.js',
70-
// path where to look for Template7 partials
71-
partialsPath: './src/pages/',
72-
// Template7 partials file extension
73-
partialsExt: '.f7p.html',
74-
// When enabled it will minify templates HTML content
75-
minifyTemplate: true,
76-
}
77-
}
42+
'framework7-loader',
7843
],
7944
},
8045

@@ -85,36 +50,27 @@ module.exports = {
8550
}
8651
```
8752

88-
## Template7 Helpers
53+
## JSX
8954

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.
55+
Framework7 v6 single file components also support JSX:
9156

92-
So, if we use helpers named `foo` and `bar` in our templates, we need to register their names in file:
57+
```html
58+
<!-- my-page.f7.html -->
59+
<script>
60+
export default () => {
61+
const msg = 'Hello world';
9362
94-
```js
95-
/* src/template7-helpers-list.js */
96-
module.exports = ['foo', 'bar'];
63+
return () => <div class="page">{msg}</div>;
64+
};
65+
</script>
9766
```
9867

99-
And specify this file in loader options:
100-
10168
```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
112-
helpersPath: './src/template7-helpers-list.js',
113-
// ...
114-
}
115-
}
116-
],
117-
},
118-
...
119-
]
69+
// my-page.f7.js
70+
71+
export default () => {
72+
const msg = 'Hello world';
73+
74+
return () => <div class="page">{msg}</div>;
75+
};
12076
```

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"name": "framework7-component-loader",
3-
"version": "3.0.0",
2+
"name": "framework7-loader",
3+
"version": "3.0.0-beta.1",
44
"description": "Framework7 single-file component loader for Webpack",
55
"main": "lib/index.js",
66
"scripts": {
77
"lint": "eslint ."
88
},
99
"repository": {
1010
"type": "git",
11-
"url": "git+https://github.com/framework7io/framework7-component-loader.git"
11+
"url": "git+https://github.com/framework7io/framework7-loader.git"
1212
},
1313
"author": "Vladimir Kharlampidi",
1414
"license": "MIT",
1515
"bugs": {
16-
"url": "https://github.com/framework7io/framework7-component-loader/issues"
16+
"url": "https://github.com/framework7io/framework7-loader/issues"
1717
},
18-
"homepage": "https://github.com/framework7io/framework7-component-loader#readme",
18+
"homepage": "https://github.com/framework7io/framework7-loader#readme",
1919
"dependencies": {
2020
"@babel/core": "^7.10.4",
2121
"loader-utils": "^1.2.3"

0 commit comments

Comments
 (0)