告诉 Scully 忽略路由的静态页面生成?

Telling Scully to Ignore Static Page Generation for a Route?

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

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

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

您可以使用 ignoredRoutePlugin

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

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

为了使用“通配符”-忽略,您可以使用 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
}