Socket
Socket
Sign inDemoInstall

@gammastream/scully-plugin-regex

Package Overview
Dependencies
285
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gammastream/scully-plugin-regex

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


Version published
Weekly downloads
17
decreased by-15%
Maintainers
1
Install size
171 kB
Created
Weekly downloads
 

Readme

Source

scully-plugin-regex

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

Version 2.0.0 introduces breaking changes in the way the plugin is configured. It allows for a bit of decoupling from the main ScullyConfig

Installation

To install this library with npm run:

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

Usage

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

import { ScullyConfig, setPluginConfig } from '@scullyio/scully';
import { getRegexPlugin } from '@gammastream/scully-plugin-regex';

const RegexPlugin = getRegexPlugin();
setPluginConfig(RegexPlugin, {
    replacements: [{
        from: 'foo',
        to: 'foobar'
    }, {
        from: new RegExp('([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)', 'gi'),
        to: '<a href="mailto:$1">$1</a>'
    }],
    routes: {
        '/products/:productId': {
            replacements: [{
                from: 'foo',
                to: 'foofoo'
            }]
        },
    }
});

export const config: ScullyConfig = {
  projectRoot: './src',
  projectName: 'scully-plugins',
  outDir: './dist/static',
  defaultPostRenderers: [RegexPlugin],
  routes: {
    '/products/:productId': {
        type: 'json',
        productId: {
            url: 'http://localhost:4200/assets/products.json',
            property: 'id',
        }
    }
  }
};

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 01 Sep 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