plugins-scully-plugin-remove-scripts
- Description: This plugin will remove all the scripts tags from the incoming HTML. If you don't want to remove all you can use some of the options.
- Type: Render Plugin
Getting Started
1. Install the plugin:
npm install -D @scullyio/scully-plugin-remove-scripts
2. Use the plugin:
export interface RemoveScriptsConfig {
predicate?: (elm: HTMLScriptElement) => boolean;
keepTransferstate?: boolean;
keepAttributes?: string[];
keepSrc?: string[];
}
You can use this plugin in scully by adding something like this to your scully.<projectname>.config.ts
import { removeScripts, RemoveScriptsConfig } from '@scullyio/scully-plugin-remove-scripts';
const defaultPostRenderers = [removeScripts, 'seoHrefOptimise'];
setPluginConfig<RemoveScriptsConfig>(removeScripts, {
keepTransferstate: false,
keepAttributes: []
});
export const config: ScullyConfig = {
...
defaultPostRenderers: = [removeScripts],
routes: {
...
}
}
The above config will use the plugin on all routes. If you want to use in on a single route, add it to the config of that particular route like this:
export const config: ScullyConfig = {
...
routes: {
someRoute: {
type: 'contentFolder',
postRenderers: = [removeScripts],
}
...
}
}