1.0.4 • Published 4 years ago
next-composer v1.0.4
next-composer
Compose NextJS plugins for NextServer config.
Installation
yarn add next-composer
Usage
// Node module
import next from 'next';
import composer from 'next-composer';
// Next plugin
import fonts from 'next-fonts';
import css from '@zeit/next-css';
import typescript from '@zeit/next-typescript';
import optimizedImages from 'next-optimized-images';
// Definition
import { ServerOptions } from 'next-server';
// Compose plugins
const nextConfig: ServerOptions = {
dev: true,
quiet: true,
conf: composer([css, fonts, optimizedImages, typescript], {
// Your next config
}),
};
// Compose plugins with their own settings
const nextConfigWithPluginsSettings: ServerOptions = {
dev: true,
quiet: true,
conf: composer(
[
[css, { cssModules: true }],
fonts,
optimizedImages,
typescript,
],
{
// Your next config
},
),
};
// NextServer instance
const nextServer = next(nextConfig);
const nextServerWithPluginsSettings = next(nextConfigWithPluginsSettings);
Author
miZyind mizyind@gmail.com
LICENSE
Licensed under the MIT License.
Thanks to
- @cyrilwanner for next-compose-plugins