
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
grunt-img2sassb64
Advanced tools
Converts image files to Base64 and saves them as SCSS or SASS variables in a single file
A grunt task to convert image files to Base64 and save them as SCSS or SASS variables in a single file.
If you save the generated file as a partial (e.g. _icons.scss
) you can easily import the file to your SCSS or SASS file and access the graphics via the variable names.
Variable names will be the file names with '.' replaced by '_'. For example, icon.png
will be $icon_png
.
Use this plugin together with a watch to have your graphics processed as soon as you place them in the given directory.
This plugin requires Grunt.
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-img2sassb64 --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('img2sassb64');
In your project's Gruntfile, add a section named img2sassb64
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
img2sassb64: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
})
Type: boolean
Default value: false
Set this to true
if you want to use SASS syntax instead of SCSS syntax.
Type: String
Default value: _
Set a string to replace @
in file names with. For example img@2x.jpg
will be stored in a variable named $img_2x_jpg
when using the default.
In this example all PNG files found in images/icons
and all GIF and JPG files in images/more_icons
will be processed using SCSS syntax and the output will be written to dest/_icons.scss
.
grunt.initConfig({
img2sassb64: {
files: {
'dest/_icons.scss': ['images/icons/*.png', 'images/more_icons/*.gif', 'images/more_icons/*.jpg'],
},
},
})
In this example all PNG files found in images/icons
and all GIF and JPG files in images/more_icons
will be processed using SASS syntax and the output will be written to dest/_icons.scss
.
grunt.initConfig({
img2sassb64: {
options: {
sassSyntax: true,
replaceAtSign: 'AT'
},
files: {
'dest/_icons.scss': ['images/icons/*.png', 'images/more_icons/*.gif', 'images/more_icons/*.jpg'],
}
}
})
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.
Copyright (c) 2014 Sven Arweiler. Licensed under the MIT license.
FAQs
Converts image files to Base64 and saves them as SCSS or SASS variables in a single file
The npm package grunt-img2sassb64 receives a total of 60 weekly downloads. As such, grunt-img2sassb64 popularity was classified as not popular.
We found that grunt-img2sassb64 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
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.