Skip to content

Commit b80adf2

Browse files
committed
Use prettier on md and json
1 parent ea1dafc commit b80adf2

File tree

11 files changed

+357
-249
lines changed

11 files changed

+357
-249
lines changed

.editorconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
99

10-
[*.md]
11-
trim_trailing_whitespace = false

.eslintrc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
22
"root": true,
33
"extends": "simenb-base",
4-
"overrides": [{
5-
"files": "test.js",
6-
"env": {
7-
"jest": true
4+
"overrides": [
5+
{
6+
"files": "test.js",
7+
"env": {
8+
"jest": true
9+
}
810
}
9-
}]
11+
],
12+
"rules": {
13+
"prettier/prettier": ["error", { "trailingComma": "all" }]
14+
}
1015
}

CHANGELOG.md

Lines changed: 79 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,149 @@
11
# Change Log
2-
All notable changes to this project will be documented in this file.
3-
This project adheres to [Semantic Versioning](http://semver.org/).
42

5-
Latest version of this document will always be available on https://github.com/SimenB/add-asset-html-webpack-plugin/releases
3+
All notable changes to this project will be documented in this file. This
4+
project adheres to [Semantic Versioning](http://semver.org/).
5+
6+
Latest version of this document will always be available on
7+
https://github.com/SimenB/add-asset-html-webpack-plugin/releases
68

79
## [Unreleased]
10+
811
### Changed
9-
- Replace Bluebird with `p-each-series`
10-
- Replace `minimatch` with `micromatch`
12+
13+
* Replace Bluebird with `p-each-series`
14+
* Replace `minimatch` with `micromatch`
1115

1216
## [2.1.2] - 2017-09-15
17+
1318
### Fixes
14-
- Fix TypeScript definition file
15-
- Allows an array of options in the plugin constructor
16-
- Added `files` property to options
19+
20+
* Fix TypeScript definition file
21+
* Allows an array of options in the plugin constructor
22+
* Added `files` property to options
1723

1824
## [2.1.1] - 2017-08-16
25+
1926
### Fixes
20-
- Fix typo in readme (`filter` -> `files`)
27+
28+
* Fix typo in readme (`filter` -> `files`)
2129

2230
## [2.1.0] - 2017-08-07
31+
2332
### Added
24-
- Support globby string as filepath option (#78, thanks @Genuifx and @NumerHero)
33+
34+
* Support globby string as filepath option (#78, thanks @Genuifx and @NumerHero)
2535

2636
## [2.0.1] - 2017-04-23
37+
2738
### Fixes
28-
- Support only string as option to files
39+
40+
* Support only string as option to files
2941

3042
## [2.0.0] - 2017-04-23
43+
3144
### Breaking
32-
- Drop support for `node<4`
45+
46+
* Drop support for `node<4`
3347

3448
### Added
35-
- Add `files` option
36-
- Allows you to only include a given asset in certain html files
37-
- Ported from https://npm.im/html-webpack-include-assets-plugin
49+
50+
* Add `files` option
51+
* Allows you to only include a given asset in certain html files
52+
* Ported from https://npm.im/html-webpack-include-assets-plugin
3853

3954
## [1.0.2] - 2016-08-07
55+
4056
### Fixes
41-
- Fix TypeScript definition file (#22, thanks @hh10k)
57+
58+
* Fix TypeScript definition file (#22, thanks @hh10k)
4259

4360
## [1.0.1] - 2016-08-06
61+
4462
### Fixes
45-
- Make `require` work without `.default` again (Fixes #20)
63+
64+
* Make `require` work without `.default` again (Fixes #20)
4665

4766
## [1.0.0] - 2016-07-29
67+
4868
### Breaking
49-
- Rename `filname` to `filepath`, which makes much more sense
69+
70+
* Rename `filname` to `filepath`, which makes much more sense
5071

5172
### Added
52-
- A Changelog!
53-
- A first attempt to add typings
54-
- Tests for 100% coverage (#17)
55-
- `outputPath` option (#16, thanks @wadahiro)
73+
74+
* A Changelog!
75+
* A first attempt to add typings
76+
* Tests for 100% coverage (#17)
77+
* `outputPath` option (#16, thanks @wadahiro)
5678

5779
### Fixes
58-
- Fix wrong documentation
80+
81+
* Fix wrong documentation
5982

6083
### Internal
61-
- Centralise linting
84+
85+
* Centralise linting
6286

6387
## [0.4.0] - 2016-07-21
88+
6489
### Added
65-
- `publicPath` option (#9, thanks @wadahiro)
90+
91+
* `publicPath` option (#9, thanks @wadahiro)
6692

6793
### Internal
68-
- Lint the code on travis
94+
95+
* Lint the code on travis
6996

7097
## [0.3.0] - 2016-07-15
98+
7199
### Added
72-
- Add `hash` option to append a hash to the filename (#8, thanks @wadahiro)
100+
101+
* Add `hash` option to append a hash to the filename (#8, thanks @wadahiro)
73102

74103
### Changed
75-
- Added a note in the readme regarding what version of `html-webpack-plugin` is needed
104+
105+
* Added a note in the readme regarding what version of `html-webpack-plugin` is
106+
needed
76107

77108
### Internal
78-
- Use AirBnB ESLint config instead of Standard
109+
110+
* Use AirBnB ESLint config instead of Standard
79111

80112
## [0.2.0] - 2016-05-30
113+
81114
### Added
82-
- Allow passing an array of files to the plugin (#6)
115+
116+
* Allow passing an array of files to the plugin (#6)
83117

84118
## [0.1.0] - 2016-05-28
119+
85120
### Changed
86-
- Pass `htmlPluginData` to the callback (#5, thanks @RyanEwen)
121+
122+
* Pass `htmlPluginData` to the callback (#5, thanks @RyanEwen)
87123

88124
## [0.0.3] - 2016-03-17
125+
89126
### Changed
90-
- Use `html-webpack-plugin-before-html-generation` as the event from `html-webpack-plugin`
127+
128+
* Use `html-webpack-plugin-before-html-generation` as the event from
129+
`html-webpack-plugin`
91130

92131
## [0.0.2] - 2016-02-27
132+
93133
### Added
94-
- A Changelog!
95-
- Use `publicPath` from webpack config if available
134+
135+
* A Changelog!
136+
* Use `publicPath` from webpack config if available
96137

97138
#### Internal
98-
- Fix URL to repo in package.json
139+
140+
* Fix URL to repo in package.json
99141

100142
## [0.0.1] - 2016-02-27
101-
Initial release
102143

144+
Initial release
103145

104-
[Unreleased]: https://github.com/SimenB/add-asset-html-webpack-plugin/compare/v2.1.2...HEAD
146+
[unreleased]: https://github.com/SimenB/add-asset-html-webpack-plugin/compare/v2.1.2...HEAD
105147
[2.1.2]: https://github.com/SimenB/add-asset-html-webpack-plugin/compare/v2.1.1...v2.1.2
106148
[2.1.1]: https://github.com/SimenB/add-asset-html-webpack-plugin/compare/v2.1.0...v2.1.1
107149
[2.1.0]: https://github.com/SimenB/add-asset-html-webpack-plugin/compare/v2.0.1...v2.1.0

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@
1313
[![Greenkeeper Dependency Status][greenkeeper-image]][greenkeeper-url]
1414

1515
## Installation
16+
1617
Install the plugin with `npm`:
18+
1719
```sh
1820
$ npm i add-asset-html-webpack-plugin -D
1921
```
2022

2123
NOTE: This plugin requires `html-webpack-plugin@^2.10.0`.
2224

2325
## Basic Usage
26+
2427
The plugin will add the given JS or CSS file to the files Webpack knows about,
2528
and put it into the list of assets `html-webpack-plugin` injects into the
2629
generated html. Add the plugin the your config, providing it a filepath:
@@ -43,6 +46,7 @@ const webpackConfig = {
4346

4447
This will add a script tag to the HTML generated by `html-webpack-plugin`, and
4548
look like:
49+
4650
```html
4751
<!DOCTYPE html>
4852
<html>
@@ -62,27 +66,30 @@ below, just pass multiple objects as an array.
6266

6367
```js
6468
new AddAssetHtmlPlugin([
65-
{ filepath: require.resolve('./some-file') },
69+
{ filepath: require.resolve('./some-file') },
6670
{ filepath: require.resolve('./some-other-file') },
6771
// Glob to match all of the dll file
6872
{ filepath: require.resolve('./**/*.dll.js') },
6973
]);
7074
```
7175

7276
## Options
77+
7378
Options are passed to the plugin during instantiation.
7479

7580
```js
7681
new AddAssetHtmlPlugin({ filepath: require.resolve('./some-file') });
7782
```
7883

7984
#### `filepath`
85+
8086
Type: `string|Glob`, mandatory
8187

8288
The absolute path of the file you want to add to the compilation, and resulting
8389
HTML file. Also support globby string.
8490

8591
#### `files`
92+
8693
Type: `string|Array<string>`, default `[]
8794

8895
Files that the assets will be added to.
@@ -91,33 +98,40 @@ By default the assets will be included in all files. If files are defined, the
9198
assets will only be included in specified file globs.
9299

93100
#### `hash`
101+
94102
Type: `boolean`, default: `false`
95103

96-
If `true`, will append a unique hash of the file to the filename. This is
97-
useful for cache busting.
104+
If `true`, will append a unique hash of the file to the filename. This is useful
105+
for cache busting.
98106

99107
#### `includeSourcemap`
108+
100109
Type: `boolean`, default: `true`
101110

102111
If `true`, will add `filepath + '.map'` to the compilation as well.
103112

104113
#### `outputPath`
114+
105115
Type: `string`
106116

107117
If set, will be used as the output directory of the file.
108118

109119
#### `publicPath`
120+
110121
Type: `string`
111122

112123
If set, will be used as the public path of the script or link tag.
113124

114125
#### `typeOfAsset`
126+
115127
Type: `string`, default: `js`
116128

117129
Can be set to `css` to create a `link`-tag instead of a `script`-tag.
118130

119131
## Examples
132+
120133
### Add a DLL file from `webpack.DllPlugin`
134+
121135
Note: Remember to build the DLL file in a separate build.
122136

123137
See [example](example/) for an example of how to set it up. You can run it by
@@ -130,6 +144,7 @@ doesn't cut it, you'll have to create a custom template and add the tags
130144
yourself.
131145

132146
#### Webpack config
147+
133148
```js
134149
const path = require('path');
135150
const webpack = require('webpack');
@@ -153,6 +168,7 @@ const webpackConfig = {
153168
```
154169

155170
Your main build:
171+
156172
```js
157173
const path = require('path');
158174
const webpack = require('webpack');
@@ -171,13 +187,12 @@ const webpackConfig = {
171187
}),
172188
new HtmlWebpackPlugin(),
173189
new AddAssetHtmlPlugin({
174-
filepath: path.resolve(__dirname,'./build/*.dll.js'),
190+
filepath: path.resolve(__dirname, './build/*.dll.js'),
175191
}),
176192
],
177193
};
178194
```
179195

180-
181196
[npm-url]: https://npmjs.org/package/add-asset-html-webpack-plugin
182197
[npm-image]: https://img.shields.io/npm/v/add-asset-html-webpack-plugin.svg
183198
[travis-url]: https://travis-ci.org/SimenB/add-asset-html-webpack-plugin

0 commit comments

Comments
 (0)