1 | /* Custom Transform Plugin example */
|
2 | const merge = require('deepmerge')
|
3 | module.exports = function customPlugin(pluginOptions) {
|
4 | // set plugin defaults
|
5 | const defaultOptions = {
|
6 | addNewLine: false
|
7 | }
|
8 | const userOptions = pluginOptions || {}
|
9 | const pluginConfig = merge(defaultOptions, userOptions)
|
10 | // return the transform function
|
11 | return function myCustomTransform (content, options) {
|
12 | const newLine = (pluginConfig.addNewLine) ? '\n' : ''
|
13 | const updatedContent = content + newLine
|
14 | return updatedContent
|
15 | }
|
16 | }
|