Support preserving the inlined asset by SorsOps · Pull Request #434 · icelam/html-inline-script-webpack-plugin
Hi @SorsOps, thank you for submitting this Pull Request, your addition of a new feature is appreciated.
How do you feel about changing preserveAsset: (assetName: string) => boolean to assetsPreservePattern: RegExp[]? I understand that using a function allows user to have more control on what assets needs to be preserved. However, consider that both existing parameters htmlMatchPattern and scriptMatchPattern are having type RegExp[], it will be more consistent and intuitive to user that preserveAsset will also accept an array of regex. I did consider changing the existing parameters to accept the feature, but I don't want users to have to tweak their webpack config when they upgrade this plugin.
We might just need to add a utility function that is similar to the existing isFileNeedsToBeInlined to achieve the same result.