Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

@scullyio/scully-plugin-remove-scripts

Package Overview
Dependencies
18
Maintainers
4
Versions
163
Issues
File Explorer

Advanced tools

@scullyio/scully-plugin-remove-scripts

Scully plugin to remove scripts

    2.1.32latest

Version published
Maintainers
4
Yearly downloads
10,542
increased by754.29%

Weekly downloads

Readme

Source

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 { /** function that receives the script element and returns false when the script needs to be removed */ predicate?: (elm: HTMLScriptElement) => boolean; /** defaults to true, keeps the transferState so the data.json can be generated */ keepTransferstate?: boolean; /** defaults to `['scullyKeep', 'sk']`. array with attributes, scripts that have one of those will be kept */ keepAttributes?: string[]; /** defaults to `[]`. Array with strings, if the fragment occurs in the SRC of the script. the script is kept*/ 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, /** overwrite default by empty string! */ 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', // Or any other type postRenderers: = [removeScripts], } ... } }

Keywords

FAQs

What is @scullyio&#x2F;scully-plugin-remove-scripts?

Scully plugin to remove scripts

Is @scullyio&#x2F;scully-plugin-remove-scripts popular?

The npm package @scullyio&#x2F;scully-plugin-remove-scripts receives a total of 21 weekly downloads. As such, @scullyio&#x2F;scully-plugin-remove-scripts popularity was classified as not popular.

Is @scullyio&#x2F;scully-plugin-remove-scripts well maintained?

We found that @scullyio&#x2F;scully-plugin-remove-scripts demonstrated a healthy version release cadence and project activity. It has 4 open source maintainers collaborating on the project.

Last updated on 20 Apr 2022
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc