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

问题描述

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

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

这是告诉 scully 跳过为 start 路由生成静态页面方法吗?

解决方法

您可以使用 ignoredRoutePlugin 执行此操作。

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

它看起来不像在文档中,但这里是 repo 中的代码: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
}

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...