Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

next-compose

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-compose

Compose NextJs plugins in a simple way

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
261
decreased by-41.48%
Maintainers
1
Weekly downloads
 
Created
Source

next-compose

Compose next-plugins in a simple way

Installation

npm install -D next-compose

or

yarn add -D next-compose

Usage

Simple example with TypeScript and Sass plugins:

const withTS = require('@zeit/next-typescript')
const withSass = require('@zeit/next-sass')
const compose = require('next-compose')

const tsConfig = {/** ts config here */}
const sassConfig = {/** sass config here */}

module.exports = compose([
  [withTS, tsConfig],
  [withSass, sassConfig],
  {
    webpack: (config) => {
      /**some special code */
      return config
    }
  }
])

Example with build vendor.css and app.css from different input extensions:

const withLess = require('@zeit/next-less')
const withSass = require('@zeit/next-sass')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const commonsChunkConfig = require('@zeit/next-css/commons-chunk-config')
const compose = require('./scripts/next-compose')}

const extractVendorCSSPlugin = new ExtractTextPlugin('static/vendor.css')
const extractAppCSSPlugin = new ExtractTextPlugin('static/app.css')

module.exports = compose([
  [withLess, {
    cssLoaderOptions: { modules: false },
    lessLoaderOptions: { /** less loader options */ },
    extractCSSPlugin: extractVendorCSSPlugin
  }],
  [withSass, {
    cssLoaderOptions: {
      modules: true,
      localIdentName: '[local]-[hash:base64:5]',
    },
    sassLoaderOptions: { /** sass loader options */ },
    extractCSSPlugin: extractAppCSSPlugin,
  }],
  {
    webpack(config, options) {
      config.plugins.push(extractVendorCSSPlugin)
      config.plugins.push(extractAppCSSPlugin)

      if (!options.isServer) {
        config = commonsChunkConfig(config, /\.(less|scss|sass)$/)
      }

      return config
    }
  }
])

FAQs

Package last updated on 21 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc