
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.
add-less-import
Advanced tools

Add an
@importstatement into a .less file at a specific point.
This is completely experimental and pretty hacky. I created this as a proof of concept for another project I'm working on, so it's also limited in scope. Currently, this will only add a single less file at a time, and the formatting and parsing logic are fairly rudimentary.
Install with npm:
npm i add-less-import --save-dev
Pass a string, the import statement to add, and a keyword in a code comment that indicates where you want the @import statement to be added.
Duplicates will only be uniqued when they are in the same "section".
Example
Assuming you have a .less file and it looks something like this:
//
// Styles
// --------------------------------------------
// Variables and mixins
@import "variables.less";
@import "mixins.less";
// Components
@import "alerts.less";
@import "buttons.less";
// Utilities
@import "utilities.less";
Here is how you would add import statements:
var addImport = require('add-less-import');
var str = fs.readFileSync('bootstrap.less', 'utf8');
// obviously you would probably want to do this dynamically,
// like with command line arguments. this is just an example
addImport(str, 'components', '@import "nav.less";');
The result would be:
//
// Styles
// --------------------------------------------
// Variables and mixins
@import "variables.less";
@import "mixins.less";
// Components
@import "alerts.less";
@import "buttons.less";
@import "nav.less";
// Utilities
@import "utilities.less";
str {String}:section {String}: The code-comment keyword to search for.statement {String}: The full import statement.options {Object}:return {String}Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on June 02, 2014.
FAQs
Add an `@import` statement into a .less file at a specific point.
The npm package add-less-import receives a total of 6 weekly downloads. As such, add-less-import popularity was classified as not popular.
We found that add-less-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.