
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
grunt-inline-import
Advanced tools
A Grunt plugin that inlines file imports.
This plugin requires Grunt >= 0.4.0
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-import --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks("grunt-inline-import");
The inlining process is destructive. Affected files will be changed permanently. Create a
backup first!
To inline your file imports, you need to specify the path to the JavaScript
file that should be modified. Additionally, you need to define the
extensions of the relevant import statements.
hello world
import stuff from "garage";
import text from "./text.txt";
inlineImport: {
options: {
extensions: {
".txt": "utf8"
}
},
task: {
src: "index.js"
}
}
import stuff from "garage";
const text = "hello world";
You may use glob patterns to inline a bunch of files at once.
inlineImport: {
options: {
extensions: {
".html": "utf8",
".css": "utf8"
}
},
task: {
src: "src/**/tpl.js"
}
}
You may provide special glob options for the glob mechanism.
For more information, check out the options of the inline-import tool.
inlineImport: {
options: {
// Global options.
extensions: {
".html": "utf8",
".png": "base64"
},
encoding: "utf8",
useVar: true,
glob: { ... },
},
task: {
options: {
// Local options.
extensions: {
".glsl": "utf8"
}
},
src: "index.js"
}
}
In order to create a backup of specific files, you'll need tools for copying and deleting files. The following example uses the basic grunt plugins grunt-contrib-copy and grunt-contrib-clean.
copy: {
backup: {
expand: true,
cwd: "src",
src: "**/tpl.js", // Copy all tpl files from src into a
dest: "backup", // backup folder while maintaining directory structures.
filter: "isFile"
},
restore: {
expand: true,
cwd: "backup",
src: "**", // Copy all backup files back into the
dest: "src", // src folder, overwriting existing files.
filter: "isFile"
}
}
clean: {
backup: ["backup"] // Remove the backup files.
}
grunt.registerTask("backup", ["restore", "copy:backup"]);
grunt.registerTask("restore", ["copy:restore", "clean:backup"]);
grunt.registerTask("prepublish", ["backup", "inlineImport"]);
grunt.registerTask("postpublish", ["restore"]);
Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
FAQs
A Grunt plugin for inlining file imports.
The npm package grunt-inline-import receives a total of 1 weekly downloads. As such, grunt-inline-import popularity was classified as not popular.
We found that grunt-inline-import 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.