Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
grunt-inline
Advanced tools
将html页面里的外链资源,比如js、css、img,变成内联资源。比如:
带有__inline
标记的link
标签,会变成内联样式
<link href="css/style.css?__inline=true" rel="stylesheet" />
带有__inline
标记的img
标签,会变成内联base64字符串
<img src="img/icon.png?__inline=true" />
带有__inline
标记的script
标签,会变成内联脚本
<script src="js/erport.js?__inline=true"></script>
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-inline --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-inline');
In your project's Gruntfile, add a section named inline
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
inline: {
dist: {
src: [ 'dist/index.html' ]
},
},
})
config
grunt.initConfig({
inline: {
dist: {
src: [ 'dist/index.html' ]
}
}
})
src/index.html
<html>
<head>
<title>demo</title>
<link href="css/style.css?__inline=true" rel="stylesheet" />
</head>
<body>
<img src="img/icon.png?__inline=true" />
<script src="js/erport.js?__inline=true"></script>
</body>
</html>
after
grunt inline
was run, it will be something like
<html>
<head>
<title>demo</title>
<style>
.container{
padding: 0;
}
</style>
</head>
<body>
<! -- base64, a terrible mass you know…so just show a little bit ...-->
<img src="idata:image/png;base64data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEMAAAAYCAYAAAChg0BHAA..." />
<script>
var Report = (function(){
return {
init: function(){
}
};
})();
</script>
</body>
</html>
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)
FAQs
Inlines img, script and link tags into the same file.
The npm package grunt-inline receives a total of 692 weekly downloads. As such, grunt-inline popularity was classified as not popular.
We found that grunt-inline demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.