mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-19 10:55:49 -05:00
Merge pull request #485 from rschamp/bugfix/fastly-config
Filter before mapping to avoid returning undefined
This commit is contained in:
commit
d360494ec2
1 changed files with 6 additions and 6 deletions
|
@ -29,13 +29,13 @@ var extraAppRoutes = [
|
||||||
*/
|
*/
|
||||||
var getStaticPaths = function (pathToStatic) {
|
var getStaticPaths = function (pathToStatic) {
|
||||||
var staticPaths = glob.sync(path.resolve(__dirname, pathToStatic));
|
var staticPaths = glob.sync(path.resolve(__dirname, pathToStatic));
|
||||||
return staticPaths.map(function (pathName) {
|
return staticPaths.filter(function (pathName) {
|
||||||
// Exclude view html, resolve everything else in the build
|
// Exclude view html, resolve everything else in the build
|
||||||
if (path.extname(pathName) !== '.html') {
|
return path.extname(pathName) !== '.html';
|
||||||
// Reduce absolute path to relative paths like '/js'
|
}).map(function (pathName) {
|
||||||
var base = path.dirname(path.resolve(__dirname, pathToStatic));
|
// Reduce absolute path to relative paths like '/js'
|
||||||
return '^' + pathName.replace(base, '') + (path.extname(pathName) ? '' : '/');
|
var base = path.dirname(path.resolve(__dirname, pathToStatic));
|
||||||
}
|
return '^' + pathName.replace(base, '') + (path.extname(pathName) ? '' : '/');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue