@webpack-blocks/extract-text
v2.1.0
Published
Webpack block for the Extract Text Plugin.
Downloads
1,368
Readme
webpack-blocks - Extract text
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
Released under the terms of the MIT license.