Catch all script?
Hi, is there a way to have pattern matching for scripts with all pages along with page-specific code? IE:
{
'*': './src/js/index.js',
'/about': './src/js/about.js'
}
Hello @markpinero,
that's a good idea. Currently you should be able to configure a wildcard to match all pages, but only one client script will be injected at a time.
That's this section in the code:
https://github.com/amannn/next-client-script/blob/de5ed6ffc9284e436764da076396515f13e859fe/packages/next-client-script/src/ClientScript.tsx#L25-L35
I guess if you'd adapt that to render a script tag for every matched client script, you could get this working.
Would you be interested in contributing this feature?
Yes, I would love to give it a shot.
Great, let me know how it goes!