
Security News
Next.js moves to scheduled security releases
Vercel is formalizing a monthly release program for Next.js. The change follows React2Shell and a sharp rise in AI-assisted vulnerability discovery.
三个grunt插件的集合,打包前端资源
npm install grunt-ne
添加下面一行到你的grunt.js:
grunt.loadNpmTasks('grunt-ne');
然后为插件增加像下面这样的配置:
grunt.initConfig({
...
pkg: {
name: "jy",
dist: "dist",
base_uri: "http://static.mail.com/jy"
},
"css-collect": {
main: {
css_src: "./css",
css_dst: "css",
img_dst: "img",
resource_map_file: "<%= pkg.dist %>/css-resource-map.json",
files: "*.css"
}
},
"spm-build": {
root: "./js",
resource_map_file: "<%= pkg.dist %>/js-resource-map.json",
resource_map: {
"bootstrap-dropdown": "ui.js"
},
options: {
src: ".",
dist: "../<%= pkg.dist %>/js"
}
},
"html-replace": {
main: {
resource_map: ["<config:css-collect.main.resource_map_file>"],
src: "./html",
files: "*.html"
}
},
...
});
读取css_src中的css文件,分析css文件中的图片引用,把这些图片保持原有目录地移到img_dst,并把图片的md5值作为该图片文件名一部分,css文件中对该图片的引用路径也更改为图片处理后的路径;移动css文件到css_dst,对css文件压缩并做把css 的md5值作为该css文件名一部分,最后产出resource_map_file。
对使用 seajs 组织的模块使用 spm 打包,最后产出resource_map_file,上线后比如在freemarker模板里如下使用, 就能无缝地去加载打包后的资源文件。
seajs.config({
...
map: <#include {path to resource map file}>
...
});
根据resource_map,对模版文件的资源引用的路径替换,暂时只能识别css引用。
FAQs
Grunt plugins including css-collect, spm-build and html-replace
The npm package grunt-ne receives a total of 1 weekly downloads. As such, grunt-ne popularity was classified as not popular.
We found that grunt-ne 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
Vercel is formalizing a monthly release program for Next.js. The change follows React2Shell and a sharp rise in AI-assisted vulnerability discovery.

Research
/Security News
11 malicious NuGet tools pose as game cheats to deploy Windows payloads, track hosts, and use Google Sheets for telemetry and control.

Research
/Security News
4 compromised asyncapi packages deliver miasma botnet loader on macOS, Linux and Windows.