aboutsummaryrefslogtreecommitdiffhomepage
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md69
1 files changed, 13 insertions, 56 deletions
diff --git a/README.md b/README.md
index bef16af..0e1ce2f 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,9 @@
4 4
5## Install 5## Install
6 6
7Install with [npm](https://npmjs.org/package/purs-loader) 7Install with [npm](https://npmjs.org/package/purs-loader).
8
9This loader works in conjunction with the [PureScript webpack plugin](https://npmjs.org/package/purescript-webpack-plugin). Ensure the plugin is installed and configured accordingly.
8 10
9``` 11```
10npm install purs-loader --save-dev 12npm install purs-loader --save-dev
@@ -12,64 +14,25 @@ npm install purs-loader --save-dev
12 14
13## Options 15## Options
14 16
15###### `noPrelude` (Boolean) 17###### `bundleOutput` (String)
16
17Toggles `--no-prelude` that omits the Prelude.
18
19###### `noTco` (Boolean)
20
21Toggles `--no-tco` that disables tail-call optimizations.
22
23###### `noMagicDo` (Boolean)
24
25Toggles `--no-magic-do` that disables optimizations overloading the do keyword generating efficient code for the `Eff` monad.
26
27###### `noOpts` (Boolean)
28
29Toggles `--no-opts` that skips the optimization phase.
30
31###### `verboseErrors` (Boolean)
32
33Toggles `--verbose-errors` that displays verbose error messages.
34
35###### `comments` (Boolean)
36 18
37Toggles `--comments` that includes comments in generated code. 19Relative path to the bundled JavaScript file generated by the `PurescriptWebpackPlugin`. The default value is `output/bundle.js`.
38
39###### `output` (String)
40
41Sets `--output=<string>` the specifies the output directory, `output` by default.
42
43###### `noPrefix` (Boolean)
44
45Toggles `--no-prefix` that does not include the comment header.
46
47###### `ffi` (String Array)
48
49Specifies the PureScript FFI files setting `--ffi=<string>`. Glob syntax is supported. This option is specified as `ffi[]=path`.
50
51###### `src` (String Array)
52
53Specifies the PureScript source files. Glob syntax is supported. This option is specified as `src[]=path`.
54 20
55## Example 21## Example
56 22
57```js 23```js
58// webpack.config.js 24// webpack.config.js
25'use strict';
59 26
60var path = require('path'); 27var PurescriptWebpackPlugin = require('purescript-webpack-plugin');
61
62var srcs = ['src[]=bower_components/purescript-*/src/**/*.purs', 'src[]=src/**/*.purs'];
63 28
64var ffis = ['ffi[]=bower_components/purescript-*/src/**/*.js']; 29var src = ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs'];
65 30
66var output = 'output'; 31var ffi = ['bower_components/purescript-*/src/**/*.js', 'src/**/*FFI.js'];
67 32
68var modulesDirectories = [ 33var modulesDirectories = [
69 'node_modules', 34 'node_modules',
70 // The bower component for purescript-prelude is specified here to 35 'bower_components'
71 // allow JavaScript files to require the 'Prelude' module globally.
72 'bower_components/purescript-prelude/src'
73]; 36];
74 37
75var config 38var config
@@ -79,12 +42,10 @@ var config
79 , filename: 'bundle.js' 42 , filename: 'bundle.js'
80 } 43 }
81 , module: { loaders: [ { test: /\.purs$/ 44 , module: { loaders: [ { test: /\.purs$/
82 , loader: 'purs-loader?output=' + output + '&' + srcs.concat(ffis).join('&') 45 , loader: 'purs-loader'
83 } ] } 46 } ] }
84 , resolve: { modulesDirectories: modulesDirectories 47 , resolve: { modulesDirectories: modulesDirectories }
85 , extensions: ['', '.js', '.purs'] 48 , plugins: [ new PurescriptWebpackPlugin({src: src, ffi: ffi}) ]
86 }
87 , resolveLoader: { root: path.join(__dirname, 'node_modules') }
88 } 49 }
89 ; 50 ;
90 51
@@ -92,7 +53,3 @@ module.exports = config;
92``` 53```
93 54
94See the [example](https://github.com/ethul/purs-loader/tree/master/example) directory for a complete example. 55See the [example](https://github.com/ethul/purs-loader/tree/master/example) directory for a complete example.
95
96## Notes
97
98A `.psci` file is generated during each run of the loader.