You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>? Configuration file follow the same approach than projects like Babel or Prettier.
103
+
104
+
**metascraper** is built out of plugins.
105
+
106
+
You can compose your own transformation pipeline using existing plugins or write your own.
107
+
108
+
When you load the library, implicitly it is loading [core plugins](#core-plugins).
109
+
110
+
Use a configuration file for load custom pipelines. The configuration file can be defined via:
111
+
112
+
- A `.metascraperrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`.
113
+
- A `prettier.config.js` file that exports an object.
114
+
- A `"metascraper"` key in your `package.json` file.
115
+
116
+
The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found.
117
+
118
+
**Note:** Using a configuration file you need to explicitly add all the plugins that you want to use.
119
+
120
+
#### Basic Configuration
121
+
122
+
Declared an `array` of `rules`, specifying each rule as `string` name of the module to load.
123
+
124
+
##### JSON
125
+
126
+
```json
127
+
// .metascraperrc
128
+
{
129
+
"rules": [
130
+
"metascraper-author",
131
+
"metascraper-date",
132
+
"metascraper-description",
133
+
"metascraper-image",
134
+
"metascraper-logo",
135
+
"metascraper-publisher",
136
+
"metascraper-title",
137
+
"metascraper-url"
138
+
]
139
+
}
140
+
```
141
+
142
+
##### YAML
143
+
144
+
```yaml
145
+
# .metascraperrc
146
+
rules:
147
+
- metascraper-author
148
+
- metascraper-date
149
+
- metascraper-description
150
+
- metascraper-image
151
+
- metascraper-logo
152
+
- metascraper-publisher
153
+
- metascraper-title
154
+
- metascraper-url
155
+
```
156
+
157
+
#### Advanced Configuration
158
+
159
+
Additionally, you can pass specific configuration per module using a `object` declaration:
160
+
161
+
##### JSON
162
+
163
+
```json
164
+
// .metascraperrc
165
+
{
166
+
"rules": [
167
+
"metascraper-author",
168
+
"metascraper-date",
169
+
"metascraper-description",
170
+
"metascraper-image",
171
+
"metascraper-logo",
172
+
{"metascraper-clearbit-logo": {
173
+
"format": "jpg"
174
+
}},
175
+
"metascraper-publisher",
176
+
"metascraper-title",
177
+
"metascraper-url"
178
+
]
179
+
}
180
+
```
181
+
182
+
##### YAML
183
+
184
+
```yaml
185
+
# .metascraperrc
186
+
rules:
187
+
- metascraper-author
188
+
- metascraper-date
189
+
- metascraper-description
190
+
- metascraper-image
191
+
- metascraper-logo
192
+
- metascraper-clearbit-logo:
193
+
format: jpg
194
+
- metascraper-publisher
195
+
- metascraper-title
196
+
- metascraper-url
197
+
```
198
+
199
+
## Plugins
200
+
201
+
?> Can't find a plugin that you want? Let's [open an issue](https://github.com/microlinkhq/metacraper/issues) to create it.
202
+
203
+
## Core Plugins
204
+
205
+
These plugins will be shipped with **metascraper** and loaded by default.
0 commit comments