1 | <div align="center">
|
2 | <a href="https://github.com/webpack/webpack">
|
3 | <img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg">
|
4 | </a>
|
5 | </div>
|
6 |
|
7 | [![npm][npm]][npm-url]
|
8 | [![node][node]][node-url]
|
9 | [![chat][chat]][chat-url]
|
10 | [![size][size]][size-url]
|
11 |
|
12 | # pilet-webpack-plugin
|
13 |
|
14 | The `pilet-webpack-plugin` helps you to build pilets using Webpack.
|
15 |
|
16 | ## Getting Started
|
17 |
|
18 | To begin, you'll need to install `pilet-webpack-plugin`:
|
19 |
|
20 | ```sh
|
21 | npm install pilet-webpack-plugin --save-dev
|
22 | ```
|
23 |
|
24 | Then add the plugin to your `webpack` config. For example:
|
25 |
|
26 | **webpack.config.js**
|
27 |
|
28 | ```js
|
29 | const { PiletWebpackPlugin } = require('pilet-webpack-plugin');
|
30 | const piletPkg = require('./package.json');
|
31 |
|
32 | module.exports = {
|
33 | plugins: [
|
34 | new PiletWebpackPlugin({
|
35 | name: piletPkg.name,
|
36 | version: piletPkg.version,
|
37 | piral: piletPkg.piral.name,
|
38 | }),
|
39 | ],
|
40 | };
|
41 | ```
|
42 |
|
43 | And run `webpack` via your preferred method.
|
44 |
|
45 | ## Options
|
46 |
|
47 | ### `variables`
|
48 |
|
49 | Allows supplying additional variables to be used as definitions. Similar to the `definePlugin`.
|
50 |
|
51 | Example:
|
52 |
|
53 | ```js
|
54 | const { PiletWebpackPlugin } = require('pilet-webpack-plugin');
|
55 | const piletPkg = require('./package.json');
|
56 |
|
57 | module.exports = {
|
58 | plugins: [
|
59 | new PiletWebpackPlugin({
|
60 | name: piletPkg.name,
|
61 | version: piletPkg.version,
|
62 | piral: piletPkg.piral.name,
|
63 | variables: {
|
64 | PIRAL_CLI_VERSION: require('piral-cli/package.json').version,
|
65 | },
|
66 | }),
|
67 | ],
|
68 | };
|
69 | ```
|
70 |
|
71 | ## Contributing
|
72 |
|
73 | Contributions in any form are appreciated and much welcome!
|
74 |
|
75 | Just make sure to post an issue or reach out to me on [Gitter](https://gitter.im/piral-io/community) before starting actual work on anything. It really helps to avoid problems.
|
76 |
|
77 | ## License
|
78 |
|
79 | This plugin is released using the MIT license.
|
80 |
|
81 | [npm]: https://img.shields.io/npm/v/pilet-webpack-plugin.svg
|
82 | [npm-url]: https://npmjs.com/package/pilet-webpack-plugin
|
83 | [node]: https://img.shields.io/node/v/pilet-webpack-plugin.svg
|
84 | [node-url]: https://nodejs.org
|
85 | [chat]: https://img.shields.io/badge/gitter-piral.io%2Fcommunity-brightgreen.svg
|
86 | [chat-url]: https://gitter.im/piral-io/community
|
87 | [size]: https://packagephobia.now.sh/badge?p=pilet-webpack-plugin
|
88 | [size-url]: https://packagephobia.now.sh/result?p=pilet-webpack-plugin
|