3.0.1 • Published 4 months ago

next-shynet v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Next-Shynet

A library for integrating shynet into your next.js project.

It helps to easily use shynet in a single page application. The library also has declarations for typescript.

Usage

Install this library:

npm install next-shynet

App router

Change your app/layout.tsx:

import { ShynetForAppRouter } from "next-shynet"

export default async function RootLayout({children}) {
    return (
        <html>
            <body>
                <ShynetForAppRouter
                    scriptSrc="https://your-shynet-instance/.../index.js"
                    imgSrc="https://your-shynet-instance/.../pixel.gif"
                />
            </body>
        </html>
    )
}

Pages router

Change your _app.js:

import Shynet from "next-shynet"

const YourApp = ({ Component, pageProps }) => (
    <div>
        <Shynet
            scriptSrc="https://your-shynet-instance/.../index.js"
            imgSrc="https://your-shynet-instance/.../pixel.gif" />
        <Component {...pageProps} />
    </div>
)

The link to the tracking pixel is optional.

By default, the script is not loaded during development. To force the script to be included, add the ignoreEnv option:

<Shynet scriptSrc="" ignoreEnv />

How to build

npm install
npm run build

The generated files will be in the /dist directory.

Authors

3.0.1

4 months ago

2.1.0

1 year ago

2.0.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago