Allow wildcard/regex/minimatch patterns for assets
morphatic opened this issue · 1 comments
Rather than listing ALL of the assets in a project, it would be nice if we could specify folder names and/or filename patterns, e.g.
UpUp.start({
'content-url': 'offline.html',
'assets': [
'/assets/*', // to include everything in the assets folder
'/js/main.*.bundle.*' // would get main.1234.bundle.js, main.1234.bundle.js.map, main.1234.bundle.min.js, etc.
]
});
Nodejs already has minimatch built into it. Sorry if I'm just ignorant about service worker security protocols, and this is a no-go.
This would be especially useful when using the angular-cli
to build Angular 2 projects. The build generates a bunch of script bundles with a unique hash as part of the filename. Right now I'm changing these out manually before uploading to the server. I guess another solution would be to update angular-cli
(webpack config) to rewrite these paths in the UpUp config when building.
I think the last solution you suggested might work for you, but I am not familiar with angular-cli myself.
As for doing it in UpUp, that isn't possible because UpUp's code runs on the client and the client can't get a list of all files in a directory on the server for security reasons.