Skip to content

Commit 279407b

Browse files
committed
update readme
1 parent ac98dc2 commit 279407b

File tree

1 file changed

+49
-29
lines changed

1 file changed

+49
-29
lines changed

README.md

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,68 @@
1-
<div align="center">
2-
<a href="http://github.com/flyjs/fly">
3-
<img width=200px src="https://cloud.githubusercontent.com/assets/8317250/8733685/0be81080-2c40-11e5-98d2-c634f076ccd7.png">
4-
</a>
5-
</div>
1+
# fly-svelte [![][travis-badge]][travis-link]
62

7-
# fly-svelte
8-
9-
> [Svelte](https://github.com/lukeed/fly-svelte) plugin for _[Fly][fly]_.
10-
11-
[![][fly-badge]][fly]
12-
[![npm package][npm-ver-link]][releases]
13-
[![][dl-badge]][npm-pkg-link]
14-
[![][travis-badge]][travis-link]
15-
[![][mit-badge]][mit]
3+
> Compile [Svelte](https://svelte.technology) components with Fly
164
175
## Install
186

19-
```a
7+
```
208
npm install --save-dev fly-svelte
219
```
2210

2311
## Usage
2412

25-
> Check out the [documentation](PLUGIN_DOCUMENTATION) to see the available options.
13+
```js
14+
exports.views = function * (fly) {
15+
yield fly.source('src/**/*.html').svelte({
16+
entry: 'src/App.html',
17+
sourceMap: 'inline'
18+
}).target('dist/js');
19+
}
20+
```
21+
22+
If you wanted, you can chain other JavaScript plugins (eg [`fly-babel`](https://github.com/flyjs/fly-babel)) immediately after Svelte compiles!
2623

2724
```js
28-
export default function* () {
29-
yield ...
25+
exports.scripts = function * (fly) {
26+
yield fly.source('src/App.html').svelte({
27+
css: false
28+
}).babel({
29+
presets: ['es2015']
30+
}).target('dist/js');
3031
}
3132
```
3233

33-
## License
3434

35-
[MIT][mit] © [Luke Edwards][author]
35+
## API
36+
37+
By default, every file from `fly.source` will be treated as an `entry` file. (This can be changed via [`options.entry`](#optionsentry).) All source files will be compiled with `.js` file extensions.
38+
39+
### .svelte(options)
40+
41+
Check out Svelte's [CLI documentation](https://github.com/sveltejs/svelte#options) to see the available options.
42+
43+
This plugin adds **two additional** options:
44+
45+
#### options.entry
46+
47+
Type: `String` or `Array`<br>
48+
Default: `null`
49+
50+
Use to specify entry file(s) from a larger source. Doing so will overwrite the the internal `fly.source` array. Useful when chaining multiple relevant tasks.
51+
52+
#### options.sourceMap
53+
54+
Type: `String`<br>
55+
Options: `'internal'` or `'external'`
56+
Default: `false`
57+
58+
Create an inline or an external sourcemap for each entry file. A `sourceMappingURL` comment is appended to each destination file.
59+
60+
> If using external maps, a `foo.js` entry will also generate a `foo.js.map` file.
61+
62+
63+
## License
3664

65+
MIT © [Luke Edwards](http://github.com/lukeed)
3766

38-
[mit]: http://opensource.org/licenses/MIT
39-
[author]: http://github.com/lukeed
40-
[releases]: https://github.com/lukeed/fly-svelte/releases
41-
[fly]: https://www.github.com/flyjs/fly
42-
[fly-badge]: https://img.shields.io/badge/fly-JS-05B3E1.svg?style=flat-square
43-
[mit-badge]: https://img.shields.io/badge/license-MIT-444444.svg?style=flat-square
44-
[npm-pkg-link]: https://www.npmjs.org/package/fly-svelte
45-
[npm-ver-link]: https://img.shields.io/npm/v/fly-svelte.svg?style=flat-square
46-
[dl-badge]: http://img.shields.io/npm/dm/fly-svelte.svg?style=flat-square
4767
[travis-link]: https://travis-ci.org/lukeed/fly-svelte
4868
[travis-badge]: http://img.shields.io/travis/lukeed/fly-svelte.svg?style=flat-square

0 commit comments

Comments
 (0)