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

1.0.2 • Public • Published

sush

NPM

standard-readme compliant npm

Core module for SUSH

Table of Contents

Install

For HTML

Insert script tags in your HTML.

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

Via Node.js

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

Usage

Via HTML

<!DOCTYPE html>
<html>
<head>
  <script src="https://unpkg.com/sush"></script> 
  <script src="https://unpkg.com/sush-plugin-trim-id"></script> 
  <script src="https://unpkg.com/sush-plugin-google-analytics"></script> 
  <script src="https://unpkg.com/sush-plugin-redirect"></script> 
  <script>
    var sheetUrl =
      'https://docs.google.com/spreadsheets/d/XXXXXX_XXXXXX/edit#gid=0';
 
    var sush = new SUSH();
    sush.flow([
      SUSH.$trimId({ head: 1 }),
      SUSH.$spreadSheet({ sheetUrl: sheetUrl }),
      SUSH.$analytics({ analyticsId: 'UA-XXXXXXXX-1' }),
      SUSH.$redirect({ fallback: '/404.html' })
    ]).catch((err) => {
      console.error(err.stack || err);
    });
  </script> 
</head>
</html>

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

import SUSH from 'sush';
import trimId from 'sush-plugin-trim-id';
import spreadSheet from 'sush-plugin-spreadsheet';
import analytics from 'sush-plugin-google-analytics';
import redirect from 'sush-plugin-redirect';
 
const sheetUrl =
  'https://docs.google.com/spreadsheets/d/XXXXXX_XXXXXX/edit#gid=0';
 
const sush = new SUSH();
sush.flow([
  trimId({ head: 1 }),
  spreadSheet({ sheetUrl: sheetUrl }),
  analytics({ analyticsId: 'UA-XXXXXXXX-1' }),
  redirect({ fallback: '/404.html' })
]).catch((err) => {
  console.error(err.stack || err);
});

Contribute

PRs accepted.

License

MIT © 3846masa

Readme

Keywords

Package Sidebar

Install

npm i sush

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • 3846masa