1

假设我们定义了以下路由:

const routes: Routes = [
  {
    path: '',
    component: WelcomeComponent
  },  
  {
    path: 'start',
    component: StartComponent
  }

有一种方法可以告诉 Scully 跳过生成start路由的静态页面吗?

4

2 回答 2

4

您可以使用ignoredRoutePlugin.

`/someRoute`:{
  type:'ignored'
}

它看起来还没有在文档中,但这里是 repo 中的代码:https ://github.com/scullyio/scully/blob/main/libs/scully/src/lib/routerPlugins/ignoredRoutePlugin.ts

于 2021-01-12T16:13:32.580 回答
3

为了使用“通配符”-忽略,您可以使用routeProcessPlugin, 在中声明./scully/plugins/plugin.ts

import { HandledRoute, registerPlugin } from '@scullyio/scully';

registerPlugin(
  'routeProcess',
  'filteredRoute',
  (routes: HandledRoute[]): Promise<HandledRoute[]> => {
    return Promise.resolve(routes.filter((r) => !r.route.startsWith('/someRoute')));
  },
);

确保将其导入您的scully.config.ts

import { ScullyConfig } from '@scullyio/scully';
require('./scully/plugins/plugin');

export const config: ScullyConfig = {
  // your config here
}
于 2021-04-15T14:17:59.743 回答