
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
css-datauri
Advanced tools
Embed assets in css files
npm install css-datauri --save-dev
Convert assets to data-urls in css-files
var CSSDataURI = require('css-datauri');
(new CSSDataURI()).encode('test/fixtures/test.css', 'tmp/default_options', (err, data) => {
// Done
});
var cssDataURISync = require('css-datauri').sync;
cssDataURISync('test/fixtures/test.css', 'tmp/default_options');
var CSSDataURI = require('css-datauri');
(new CSSDataURI())
.on('success', (content) => {
// Done
})
.on('error', err => { throw(err); })
.encode('test/fixtures/test.css', 'tmp/default_options');
var cssDataURIPromise = require('../lib/css-datauri').promise;
cssDataURIPromise('test/fixtures/test.css', 'tmp/default_options')
.then((content) => {
// Done
}).catch(err => { throw(err); });
Filter assets by glob pattern
var CSSDataURI = require('css-datauri');
(new CSSDataURI({
filter: ['test/fixtures/fonts/**/*']
})).encode('test/fixtures/test.css', 'tmp/custom_options', (err, data) => {
// Done
});
var cssDataURISync = require('css-datauri').sync;
cssDataURISync('test/fixtures/test.css', 'tmp/custom_options', {
filter: ['test/fixtures/fonts/**/*']
});
Install css-datauri globally:
npm install css-datauri -g
Run --help to show usage information:
Usage: css-datauri [options] <src> <dest>
Options:
-h, --help output usage information
-V, --version output the version number
-f, --filter [name] Filter assets by glob pattern
-b, --base [name] Set path to asset directory
Type: Array
Default value: ['**/*']
Filter assets by glob pattern
Type: String
Default value: auto
Set path to asset directory. If not specified, it's determined from source file.
FAQs
Embed assets in css files
We found that css-datauri 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.