sush-plugin-redirect
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

sush-plugin-redirect

NPM

standard-readme compliant npm

Redirect to URL associated with id.

Table of Contents

Install

For HTML

Insert script tags in your HTML.

<script src="https://unpkg.com/sush"></script>
<script src="https://unpkg.com/sush-plugin-redirect"></script>
<!-- Add script tags of SUSH Plugins -->

Via Node.js

npm install --save sush sush-plugin-redirect [...SUSH_PLUGINS]

Usage

Via HTML

<!DOCTYPE html>
<html>
<head>
  <script src="https://unpkg.com/sush"></script> 
  <script src="https://unpkg.com/sush-plugin-redirect"></script> 
  <script>
    var sush = new SUSH();
 
    sush.flow([
      SUSH.$redirect({ fallback: './404.html' })
    ])
    .catch((err) => {
      // Throw error if not found and not set fallback
      console.error(err.stack || err);
    });
  </script> 
</head>
</html>

Via Node.js (e.g. Browserify, Webpack)

import SUSH from 'sush';
import redirect from 'sush-plugin-redirect';
 
const sush = new SUSH();
 
sush.flow([
  redirect({ fallback: './404.html' })
])
.catch((err) => {
  // Throw error if not found and not set fallback
  console.error(err.stack || err);
});

Contribute

PRs accepted.

License

MIT © 3846masa

Package Sidebar

Install

npm i sush-plugin-redirect

Weekly Downloads

0

Version

1.0.3

License

MIT

Last publish

Collaborators

  • 3846masa