Socket
Socket
Sign inDemoInstall

@gammastream/scully-regex

Package Overview
Dependencies
311
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gammastream/scully-regex

A Scully postRender plugin for performing regex transformations on the generated html.


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

scully-regex

This postRenderer plugin for Scully will apply the configured regex replacements to your Scully rendered HTML.

Installation

To install this library with npm run

$ npm install @gammastream/scully-regex --save-dev

Usage

Add the plugin to the defaultPostRenderers to execute it on all rendered pages:

const {RouteTypes} = require('@scullyio/scully');
const {RegexHtml} = require('@gammastream/scully-regex');

const defaultPostRenderers = [RegexHtml];

const regexOptions = {
    replacements: [{
        from: 'http://www.googletagmanager.com',
        to: 'https://www.googletagmanager.com'
    }, {
        from: 'foo',
        to: 'bar'
    }, {
        from: new RegExp('([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)', 'gi'),
        to: '<a href="mailto:$1">$1</a>'
    }]
};


exports.config = {
  projectRoot: './src/app',
  regexOptions,
  defaultPostRenderers,
  routes: {}
};

Build app and run scully like normal.

npm run build
npm run scully

Questions or Issues

If you have any issues you can raise them here or contact me at: GammaStream

Keywords

FAQs

Last updated on 11 Feb 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc