switch to using [param].html style filenames

This commit is contained in:
Rich Harris
2017-12-11 17:04:21 -05:00
parent 727782aca2
commit 642c2904df
2 changed files with 8 additions and 8 deletions

View File

@@ -7,11 +7,11 @@ module.exports = function create_matchers(files) {
if (parts[parts.length - 1] === 'index') parts.pop();
const dynamic = parts
.filter(part => part[0] === '%')
.filter(part => part[0] === '[')
.map(part => part.slice(1, -1));
const pattern = new RegExp(
`^\\/${parts.map(p => p[0] === '%' ? '([^/]+)' : p).join('\\/')}$`
`^\\/${parts.map(p => p[0] === '[' ? '([^/]+)' : p).join('\\/')}$`
);
const test = url => pattern.test(url);