|
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] |
6 | 2 |
|
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 |
16 | 4 |
|
17 | 5 | ## Install
|
18 | 6 |
|
19 |
| -```a |
| 7 | +``` |
20 | 8 | npm install --save-dev fly-svelte
|
21 | 9 | ```
|
22 | 10 |
|
23 | 11 | ## Usage
|
24 | 12 |
|
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! |
26 | 23 |
|
27 | 24 | ```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'); |
30 | 31 | }
|
31 | 32 | ```
|
32 | 33 |
|
33 |
| -## License |
34 | 34 |
|
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 |
36 | 64 |
|
| 65 | +MIT © [Luke Edwards](http://github.com/lukeed) |
37 | 66 |
|
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 |
47 | 67 | [travis-link]: https://travis-ci.org/lukeed/fly-svelte
|
48 | 68 | [travis-badge]: http://img.shields.io/travis/lukeed/fly-svelte.svg?style=flat-square
|
0 commit comments