
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
assets-to-map-webpack-plugin
Advanced tools
A plugin for webpack
Extract bundle(s) generated by webpack and add it in a file JSON or YAML or TOML.
Originally we used it on a Hugo.io project: we needed to inline in a template style and script generated by Webpack.
To do so, we decided to go through /Data repertory to access it with Hugo environment variables .Data
.
$ npm install --save-dev assets-to-map-webpack-plugin
or
$ yarn add -D assets-to-map-webpack-plugin
module.exports = {
// more webpack config
plugins: [
new AssetsToMap({
// options
})
]
}
{String}
(default: ""
){String}
(default: ""
){String}
(default: ""
)"json"
)"json"
"toml"
"yaml"
(The format will also defines the extension of the output file){Object}
required{key: "name"}
key
will be used as the key in the generated json filename
is the name of the bundle you're appending to the generated json file.{Bool}
(default: false
){Bool}
(default: false
)The example below will create a file ./site/data/assets.json
containing two keys: css
(from the file generated by ExtractTextPlugin) and js
, both located in ./site/static
.
tracking.js
will not be included in assets.json
for it's not declared in the files
option.
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
+const AssetsToMap = require('assets-to-map-webpack-plugin');
module.exports = {
entry: {
main: [
"./assets/js/app.js",
"./assets/css/main.css"
],
tracking: "./assets/js/tracking.js",
},
output: {
path: path.join(__dirname, "site/static"),
filename: "[name].js"
},
module: {
loaders: [
// ...
]
},
plugins: [
new ExtractTextPlugin("[name].css"),
// JS optimizations like
// new UglifyJSPlugin(),
+ new AssetsToMap({
+ sourcePath: "site/static/",
+ outputPath: "site/data/",
+ filename: "assets",
+ files: {
+ css: "main.css",
+ js: "main.js"
+ }
+ }),
]
};
FAQs
Append build assets to a mappable file
The npm package assets-to-map-webpack-plugin receives a total of 0 weekly downloads. As such, assets-to-map-webpack-plugin popularity was classified as not popular.
We found that assets-to-map-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
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.