aboutsummaryrefslogtreecommitdiffhomepage
path: root/README.md
diff options
context:
space:
mode:
authoreric <thul.eric@gmail.com>2015-07-06 23:58:28 -0400
committereric <thul.eric@gmail.com>2015-07-06 23:58:28 -0400
commit1d771135e825feaa1fba5177b60796578766b240 (patch)
treea063817b17ee2df146228cf66c4205c2d80f05be /README.md
parent4558c6cf7879207166b1cc013e2e8112f558bb1d (diff)
parent167c852f657b4746331c4f89e358a4a4876ced78 (diff)
downloadpurs-loader-1d771135e825feaa1fba5177b60796578766b240.tar.gz
purs-loader-1d771135e825feaa1fba5177b60796578766b240.tar.zst
purs-loader-1d771135e825feaa1fba5177b60796578766b240.zip
Merge pull request #16 from ethul/topic/issue-11-and-14
Topic/issue 11 and 14
Diffstat (limited to 'README.md')
-rw-r--r--README.md54
1 files changed, 53 insertions, 1 deletions
diff --git a/README.md b/README.md
index d243381..a45573f 100644
--- a/README.md
+++ b/README.md
@@ -44,10 +44,62 @@ Sets `--output=<string>` the specifies the output directory, `output` by default
44 44
45Toggles `--no-prefix` that does not include the comment header. 45Toggles `--no-prefix` that does not include the comment header.
46 46
47###### `requirePath` (String)
48
49Sets `--require-path=<string>` that specifies the path prefix to use for `require()` calls in the generated JavaScript.
50
51###### `ffi` (String Array)
52
53Specifies the PureScript FFI files setting `--ffi=<string>`. Glob syntax is supported. This option is specified as `ffi[]=path`.
54
47###### `src` (String Array) 55###### `src` (String Array)
48 56
49Specifies PureScript source paths to be globbed for `.purs` files. By default, `bower_components` is search. Additional paths may be specified using this option. This option is specified as `src[]=path`. 57Specifies the PureScript source files. Glob syntax is supported. This option is specified as `src[]=path`.
50 58
51## Example 59## Example
52 60
61```js
62// webpack.config.js
63
64var path = require('path');
65
66var srcs = ['src[]=bower_components/purescript-*/src/**/*.purs', 'src[]=src/**/*.purs'];
67
68var ffis = ['ffi[]=bower_components/purescript-*/src/**/*.js'];
69
70var output = 'output';
71
72var modulesDirectories = [
73 'node_modules',
74 // The bower component for purescript-prelude is specified here to
75 // allow JavaScript files to require the 'Prelude' module globally.
76 'bower_components/purescript-prelude/src',
77 // The output directory is specified here to allow PureScript files in
78 // your source to import other PureScript modules in your source.
79 output
80];
81
82var config
83 = { entry: './src/entry'
84 , output: { path: __dirname
85 , pathinfo: true
86 , filename: 'bundle.js'
87 }
88 , module: { loaders: [ { test: /\.purs$/
89 , loader: 'purs-loader?output=' + output + '&' + srcs.concat(ffis).join('&')
90 } ] }
91 , resolve: { modulesDirectories: modulesDirectories
92 , extensions: ['', '.js', '.purs']
93 }
94 , resolveLoader: { root: path.join(__dirname, 'node_modules') }
95 }
96 ;
97
98module.exports = config;
99```
100
53See the [example](https://github.com/ethul/purs-loader/tree/master/example) directory for a complete example. 101See the [example](https://github.com/ethul/purs-loader/tree/master/example) directory for a complete example.
102
103## Notes
104
105A `.psci` file is generated during each run of the loader.