Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
grunt-contrib-less
Advanced tools
The grunt-contrib-less package is a Grunt plugin that compiles LESS files to CSS. It provides a variety of options to customize the compilation process, such as specifying source maps, compressing the output, and including additional paths for @import directives.
Basic Compilation
This feature allows you to compile LESS files into CSS. The 'paths' option specifies directories to scan for @import directives.
{
"less": {
"development": {
"options": {
"paths": ["assets/css"]
},
"files": {
"path/to/result.css": "path/to/source.less"
}
}
}
}
Source Maps
This feature enables the generation of source maps, which help in debugging by mapping the compiled CSS back to the original LESS source.
{
"less": {
"development": {
"options": {
"sourceMap": true,
"sourceMapFilename": "path/to/result.css.map",
"sourceMapURL": "result.css.map"
},
"files": {
"path/to/result.css": "path/to/source.less"
}
}
}
}
Compression
This feature allows you to compress the output CSS, reducing file size for production environments.
{
"less": {
"production": {
"options": {
"compress": true
},
"files": {
"path/to/result.min.css": "path/to/source.less"
}
}
}
}
Custom Functions
This feature allows you to define custom functions that can be used within your LESS files.
{
"less": {
"development": {
"options": {
"functions": {
"add": function(less, a, b) {
return a + b;
}
}
},
"files": {
"path/to/result.css": "path/to/source.less"
}
}
}
}
The 'less' package is the official LESS compiler. It can be used directly via the command line or integrated into build systems. It offers similar functionalities to grunt-contrib-less but does not provide the Grunt-specific integration.
The 'gulp-less' package is a Gulp plugin for compiling LESS files. It offers similar functionalities to grunt-contrib-less but is designed to work within the Gulp task runner ecosystem.
The 'less-loader' package is a Webpack loader for compiling LESS files. It integrates LESS compilation into the Webpack build process, offering similar functionalities but within the Webpack ecosystem.
Compile LESS files to CSS.
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-contrib-less
Then add this line to your project's grunt.js
gruntfile:
grunt.loadNpmTasks('grunt-contrib-less');
Inside your grunt.js
file add a section named less
. This section specifies the files to compile and the options passed to LESS.
object
This defines what files this task will process and should contain key:value pairs.
The key (destination) should be an unique filepath (supports grunt.template) and the value (source) should be a filepath or an array of filepaths (supports minimatch).
As of v0.3.0, you can use *.{ext} as your destination filename to individually compile each file to the destination directory. Otherwise, when the source contains an array of multiple filepaths, the contents are concatenated in the order passed.
object
This controls how this task (and its helpers) operate and should contain key:value pairs, see options below.
string|array
This specifies directories to scan for @import directives when parsing. Default value is the directory of the source, which is probably what you want.
boolean
If set to true
, the generated CSS will be minified.
boolean
If set to true
, the generated CSS will be minified with YUI Compressor's CSS minifier.
less: {
development: {
options: {
paths: ["assets/css"]
},
files: {
"path/to/result.css": "path/to/source.less"
}
},
production: {
options: {
paths: ["assets/css"],
yuicompress: true
},
files: {
"path/to/result.css": "path/to/source.less"
}
}
}
--
Task submitted by Tyler Kellen.
FAQs
Compile LESS files to CSS
The npm package grunt-contrib-less receives a total of 103,023 weekly downloads. As such, grunt-contrib-less popularity was classified as popular.
We found that grunt-contrib-less demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.