diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 60 |
1 files changed, 57 insertions, 3 deletions
@@ -2,16 +2,70 @@ | |||
2 | 2 | ||
3 | > [PureScript](http://www.purescript.org) loader for [webpack](http://webpack.github.io) | 3 | > [PureScript](http://www.purescript.org) loader for [webpack](http://webpack.github.io) |
4 | 4 | ||
5 | - Supports hot-reloading and rebuilding of single source files | ||
6 | - Dead code elimination using the `bundle` option | ||
7 | - Colorized build output using `purescript-psa` and the `psc: "psa"` option | ||
8 | |||
5 | ## Install | 9 | ## Install |
6 | 10 | ||
7 | Install with [npm](https://npmjs.org/package/purs-loader). | 11 | Install with [npm](https://npmjs.org/package/purs-loader). |
8 | 12 | ||
9 | This loader works in conjunction with the [PureScript webpack plugin](https://npmjs.org/package/purescript-webpack-plugin). Ensure the plugin is installed and configured accordingly. | ||
10 | |||
11 | ``` | 13 | ``` |
12 | npm install purs-loader --save-dev | 14 | npm install purs-loader --save-dev |
13 | ``` | 15 | ``` |
14 | 16 | ||
15 | ## Example | 17 | ## Example |
16 | 18 | ||
17 | Refer to the [purescript-webpack-example](https://github.com/ethul/purescript-webpack-example) for an example. | 19 | ```javascript |
20 | const webpackConfig = { | ||
21 | // ... | ||
22 | loaders: [ | ||
23 | // ... | ||
24 | { | ||
25 | test: /\.purs$/, | ||
26 | loader: 'purs-loader', | ||
27 | exclude: /node_modules/, | ||
28 | query: { | ||
29 | psc: 'psa', | ||
30 | src: ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs'], | ||
31 | ffi: ['bower_components/purescript-*/src/**/*.js', 'src/**/*.js'], | ||
32 | } | ||
33 | } | ||
34 | // ... | ||
35 | ] | ||
36 | // ... | ||
37 | } | ||
38 | ``` | ||
39 | |||
40 | ### Options | ||
41 | |||
42 | Default options: | ||
43 | |||
44 | ```javascript | ||
45 | { | ||
46 | psc: 'psc', | ||
47 | pscArgs: {}, | ||
48 | pscBundle: 'psc-bundle', | ||
49 | pscBundleArgs: {}, | ||
50 | pscIde: false, // instant rebuilds using psc-ide-server (experimental) | ||
51 | pscIdeColors: false, // defaults to true if psc === 'psa' | ||
52 | bundleOutput: 'output/bundle.js', | ||
53 | bundleNamespace: 'PS', | ||
54 | bundle: false, | ||
55 | warnings: true, | ||
56 | output: 'output', | ||
57 | src: [ | ||
58 | path.join('src', '**', '*.purs'), | ||
59 | path.join('bower_components', 'purescript-*', 'src', '**', '*.purs') | ||
60 | ], | ||
61 | ffi: [ | ||
62 | path.join('src', '**', '*.js'), | ||
63 | path.join('bower_components', 'purescript-*', 'src', '**', '*.js') | ||
64 | ], | ||
65 | } | ||
66 | ``` | ||
67 | |||
68 | ### Instant rebuilds (experimental) | ||
69 | |||
70 | Experimental support for instant rebuilds using `psc-ide-server` can be enabled | ||
71 | via the `pscIde: true` option. | ||