Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
link-media-ext-html-webpack-plugin
Advanced tools
Adds standard or custom media attributes to link tags processed by html-webpack-plugin
This is an extension plugin for html-webpack-plugin. It sets standard and custom media attributes for link tags like link-media-html-webpack-plugin but uses configuration object similar to script-ext-html-webpack-plugin.
You must be running webpack (4.x) on node 6+.
Install plugin with npm:
$ npm install link-media-ext-html-webpack-plugin -D
Or yarn:
$ yarn add link-media-ext-html-webpack-plugin -D
Please note that you will need html-webpack-plugin v3.0.6+ and CSS extraction plugin e.g. mini-css-extract-plugin.
Load the plugin:
const LinkMediaExtHtmlWebpackPlugin = require('link-media-ext-html-webpack-plugin');
Add the plugin to your webpack config as follows:
plugins: [
new HtmlWebpackPlugin(),
new MiniCssExtractPlugin({
filename: '[name].css',
}),
new LinkMediaExtHtmlWebpackPlugin()
]
The order is important — the plugin must come after HtmlWebpackPlugin. The above configuration will actually do nothing.
You must pass a configuration object to the plugin. You can define only those properties that you need.
new LinkMediaExtHtmlWebpackPlugin({
defaultAttribute: 'screen',
all: [],
print: [],
screen: [],
speech: [],
custom: [{
test: '',
value: ''
}]
})
all
/ screen
/ speech
/ print
— stylesheet matching pattern defining link tags that should have media attributes all / screen / speech / print appropriately.custom
— array of objects with following structure:test
: stylesheet matching pattern defining link tags that should have media attribute with custom value added.value
: a String
value for the attribute; if not set the attribute has no value set (equivalent of true)A stylesheet matching pattern matches against a stylesheets’s name. It can be one of:
String
matches if it is a substring of the script name;RegExp
;String
's and/or RegExp
's — matches if any one element matches.Set all link tags media attributes to screen:
new LinkMediaExtHtmlWebpackPlugin({
defaultAttribute: 'screen'
})
Set media attribute for main.css to screen and for print1.css, print2.css to print:
new LinkMediaExtHtmlWebpackPlugin({
screen: 'main.css',
print: [/print1.css/, 'print2.css']
})
Set link tags media attributes screen except main.css which is all:
new LinkMediaExtHtmlWebpackPlugin({
defaultAttribute: 'screen',
all: [/main.css/],
})
v.1.0.x Initial release
FAQs
Adds standard or custom media attributes to link tags processed by html-webpack-plugin
We found that link-media-ext-html-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.