Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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
The npm package link-media-ext-html-webpack-plugin receives a total of 11 weekly downloads. As such, link-media-ext-html-webpack-plugin popularity was classified as not popular.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.