diff --git a/README.md b/README.md index 194b626..e70c1f5 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ To install, add the following lines to your **netlify.toml** file: ```toml [[plugins]] package = "netlify-plugin-amp-server-side-rendering" + [plugins.inputs] + ignorePattern = "public/admin/*" ``` [1]: https://amp.dev/ diff --git a/manifest.yml b/manifest.yml index 0668538..d2c84f8 100644 --- a/manifest.yml +++ b/manifest.yml @@ -1 +1,4 @@ name: netlify-plugin-amp-server-side-rendering +inputs: + - name: ignorePattern + description: Ignore pattern diff --git a/src/index.js b/src/index.js index 4bdb58d..2dc0253 100644 --- a/src/index.js +++ b/src/index.js @@ -3,12 +3,19 @@ const fs = require('fs'); const glob = require('glob'); module.exports = { - onPostBuild: async ({ constants, utils }) => { + onPostBuild: async ({ inputs, constants, utils }) => { const pattern = constants.PUBLISH_DIR + '/**/*.html'; + const options = { + nodir: true + } + + if (inputs.ignorePattern) { + options.ignore = inputs.ignorePattern + } const files = await new Promise((resolve, reject) => { - glob(pattern, { nodir: true }, (err, files) => { - (err) ? reject(err) : resolve(files); + glob(pattern, options, (err, files) => { + (err) ? reject(err): resolve(files); }); }); @@ -25,4 +32,4 @@ module.exports = { summary: `Successfully rendered ${files.length} file(s).` }); } -}; +}; \ No newline at end of file