Skip to content

Commit 1708e5c

Browse files
SanderEliasVillanuevand
authored andcommitted
feat(voidplugin): plugin that lets you exclude routes
this is a sample plugin that allows an de to exclude a oute from being generated by scully closes #154 * fix(scully.config.js): remove unneeded import
1 parent 4d580f2 commit 1708e5c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

extraPlugin/voidPlugin.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const {configValidator, registerPlugin} = require('../dist/scully');
2+
3+
const voidPlugin = async (route, options) => {
4+
/**
5+
* I don't do anything here,
6+
* just return an empty array
7+
* as that will effectively remove the route from the list
8+
* */
9+
return [];
10+
};
11+
12+
voidPlugin[configValidator] = async conf => [];
13+
registerPlugin('router', 'void', voidPlugin);

scully.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** load the plugin */
22
require('./extraPlugin/extra-plugin.js');
3+
require('./extraPlugin/voidPlugin');
34

45
exports.config = {
56
/** projectRoot is mandatory! */
@@ -88,5 +89,8 @@ exports.config = {
8889
folder: './blog',
8990
},
9091
},
92+
'/**': {
93+
type: 'void',
94+
},
9195
},
9296
};

0 commit comments

Comments
 (0)