Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add the ability to exclude assets based on RegExp patterns

License

NotificationsYou must be signed in to change notification settings

jamesjieye/html-webpack-exclude-assets-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm versionBuild Statusjs-semistandard-style

Enhanceshtml-webpack-pluginfunctionality by adding the{excludeAssets: RegExp | [RegExp]} option to allow you to exclude assets.

When adding an entry with third party css files, for example,style: ['bootstrap/dist/css/bootstrap.css'], to webpack, the injected scripts include style.js or style.[chunkhash].js. TheexcludeChunks option ofhtml-webpack-plugin will exclude both style.css and style.js. With this plugin, you can keep style.css in and style.js out by settingexcludeAssets: /style.*.js/.

You can also exclude CSS assets, for example, a theme CSS style, by settingexcludeAssets: /theme.*.css/.

Installation

You must be running webpack on Node v4.0.0 or higher.

Note:style-loader's dependencyloader-utils only supports Node v4.0.0 since v1.0. Seestyle-loader's#174 pull request for details.

Install the plugin with npm:

$ npm install --save-dev html-webpack-exclude-assets-plugin

Basic Usage

Require the plugin in your webpack config:

varHtmlWebpackExcludeAssetsPlugin=require('html-webpack-exclude-assets-plugin');

Add the plugin to your webpack config as follows:

plugins:[newHtmlWebpackPlugin(),newHtmlWebpackExcludeAssetsPlugin()]

The above configuration will actually do nothing due to the configuration defaults.

When you setexcludeAssets to an array of regular expressions or a single regular expression, the matched assets will be skipped when the chunks are injected into the HTML template.

plugins:[newHtmlWebpackPlugin({excludeAssets:[/style.*.js/]// exclude style.js or style.[chunkhash].js}),newHtmlWebpackExcludeAssetsPlugin()]

About

Add the ability to exclude assets based on RegExp patterns

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors6


[8]ページ先頭

©2009-2025 Movatter.jp