Socket
Book a DemoInstallSign in
Socket

@webpack-blocks/extract-text

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webpack-blocks/extract-text

Webpack block for the Extract Text Plugin.

latest
Source
npmnpm
Version
2.1.0
Version published
Weekly downloads
363
15.24%
Maintainers
2
Weekly downloads
 
Created
Source

webpack-blocks - Extract text

Gitter chat NPM Version

Use this block to extract text (for example CSS) from the bundle into a separate file. Uses Extract Text Plugin.

Installation

# for webpack v3
npm install --save-dev @webpack-blocks/extract-text
# for webpack v2 install the last v1.0 beta version
npm install --save-dev @webpack-blocks/extract-text@^1.0.0-beta.2

Usage

const { createConfig } = require('@webpack-blocks/webpack')
const extractText = require('@webpack-blocks/extract-text')

module.exports = createConfig([
  /* ... */
  extractText('path/to/output.file')
])

Most likely you’ll use it to extract styles:

const { createConfig, match, env } = require('@webpack-blocks/webpack')
const { css } = require('@webpack-blocks/assets')
const extractText = require('@webpack-blocks/extract-text')

module.exports = createConfig([
  match('*.css', [
    css(),
    // Filename defaults to 'css/[name].[contenthash:8].css'
    // Extract styles only in production mode
    // to keep styles hot reload in development
    env('production', [extractText()])
  ])
])

webpack-blocks

Check out the

👉 Main documentation

Released under the terms of the MIT license.

Keywords

webpack

FAQs

Package last updated on 27 Apr 2020

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