0.0.11 • Published 4 years ago

next-prefixed v0.0.11

Weekly downloads
121
License
-
Repository
github
Last release
4 years ago

Codecov code style: prettier CircleCI npm npm

Read More

Installation

yarn add next-prefixed

Usage

next-prefixed exports components for rendering prefixed links and images. It also exports a function to prefix any url.

To set the prefix for the URLs, set the assetPrefix in your next.config.js.

const debug = process.env.NODE_ENV !== 'production';
const assetPrefix = debug ? '' : '/your_prefix/';

module.exports = withPlugins([withCSS, withMDX, withBlog], {
  assetPrefix,
  publicRuntimeConfig: {
    assetPrefix
  }
});

prefixURL

import { prefixURL } from 'next-prefixed';

prefixURL('/blog'); // => my_prefix/blog

Image

Passes all props to HTML img tag.

import { Image } from 'next-prefixed';

const Example = () => <Image src="pony.png" alt="Valiant Horse" />;

Link

Passes all props to next.js Link component.

import { Link } from 'next-prefixed';

const Example = () => <Link to="/blog" />;
0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

6 years ago

0.0.3

6 years ago

0.0.1

6 years ago