diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 69 |
1 files changed, 13 insertions, 56 deletions
@@ -4,7 +4,9 @@ | |||
4 | 4 | ||
5 | ## Install | 5 | ## Install |
6 | 6 | ||
7 | Install with [npm](https://npmjs.org/package/purs-loader) | 7 | Install with [npm](https://npmjs.org/package/purs-loader). |
8 | |||
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. | ||
8 | 10 | ||
9 | ``` | 11 | ``` |
10 | npm install purs-loader --save-dev | 12 | npm 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 | |||
17 | Toggles `--no-prelude` that omits the Prelude. | ||
18 | |||
19 | ###### `noTco` (Boolean) | ||
20 | |||
21 | Toggles `--no-tco` that disables tail-call optimizations. | ||
22 | |||
23 | ###### `noMagicDo` (Boolean) | ||
24 | |||
25 | Toggles `--no-magic-do` that disables optimizations overloading the do keyword generating efficient code for the `Eff` monad. | ||
26 | |||
27 | ###### `noOpts` (Boolean) | ||
28 | |||
29 | Toggles `--no-opts` that skips the optimization phase. | ||
30 | |||
31 | ###### `verboseErrors` (Boolean) | ||
32 | |||
33 | Toggles `--verbose-errors` that displays verbose error messages. | ||
34 | |||
35 | ###### `comments` (Boolean) | ||
36 | 18 | ||
37 | Toggles `--comments` that includes comments in generated code. | 19 | Relative path to the bundled JavaScript file generated by the `PurescriptWebpackPlugin`. The default value is `output/bundle.js`. |
38 | |||
39 | ###### `output` (String) | ||
40 | |||
41 | Sets `--output=<string>` the specifies the output directory, `output` by default. | ||
42 | |||
43 | ###### `noPrefix` (Boolean) | ||
44 | |||
45 | Toggles `--no-prefix` that does not include the comment header. | ||
46 | |||
47 | ###### `ffi` (String Array) | ||
48 | |||
49 | Specifies the PureScript FFI files setting `--ffi=<string>`. Glob syntax is supported. This option is specified as `ffi[]=path`. | ||
50 | |||
51 | ###### `src` (String Array) | ||
52 | |||
53 | Specifies 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 | ||
60 | var path = require('path'); | 27 | var PurescriptWebpackPlugin = require('purescript-webpack-plugin'); |
61 | |||
62 | var srcs = ['src[]=bower_components/purescript-*/src/**/*.purs', 'src[]=src/**/*.purs']; | ||
63 | 28 | ||
64 | var ffis = ['ffi[]=bower_components/purescript-*/src/**/*.js']; | 29 | var src = ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs']; |
65 | 30 | ||
66 | var output = 'output'; | 31 | var ffi = ['bower_components/purescript-*/src/**/*.js', 'src/**/*FFI.js']; |
67 | 32 | ||
68 | var modulesDirectories = [ | 33 | var 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 | ||
75 | var config | 38 | var 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 | ||
94 | See the [example](https://github.com/ethul/purs-loader/tree/master/example) directory for a complete example. | 55 | See the [example](https://github.com/ethul/purs-loader/tree/master/example) directory for a complete example. |
95 | |||
96 | ## Notes | ||
97 | |||
98 | A `.psci` file is generated during each run of the loader. | ||