パッケージの詳細

@webpack-blocks/extract-text

andywer2.4kMIT2.1.0

Webpack block for the Extract Text Plugin.

webpack, webpack-blocks

readme

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.

更新履歴

@webpack-blocks/extract-text - Changelog

2.0.0-alpha

  • Remove deprecated fileType API (#260)
  • Support for webpack 4 (#261)

1.0.0-rc

  • Breaking change: drop webpack 2 support, update extract-text-webpack-plugin to v3

1.0.0-beta.2

  • Update dependency version

1.0.0-beta

  • Use match() instead of fileType option

1.0.0-alpha

  • Updated for new core API (#125)
  • Requires node 6+

0.4.0

  • Using updated @webpack-blocks/webpack-common to work with updated webpack-merge

0.3.0

Initial non-beta release. Aligned with the v0.3 release changes.

0.1.0-beta

Initial beta release.