New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

component-data-uri

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

component-data-uri

A plugin to automatically convert file, especially images, to data URI scheme for the component builder

  • 0.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

component-data-uri

A plugin to transpile image files to data URI for component builder

Install

npm install component-data-uri

Usage

Add image files to the dataURIs array in your component.json:

{
	"dataURIs": [
		"images/1.png",
		"images/2.png"
	]
}

Use the plugin during your build process:

var Builder = require('component-builder'),
    fs = require('fs'),
    dataUri = require('component-data-uri');

var builder = new Builder(__dirname);

builder.use(dataUri);

builder.build(function (err, res) {
  if (err) {
    console.log(err);
  }
  fs.writeFileSync('example/build.js', res.require + res.js);
  if (res.css) fs.writeFileSync('build/build.css', res.css);
});

Or

component build -u component-data-uri

And then require the files in your javascript:

var img = require('images/1.png');

Keywords

FAQs

Package last updated on 08 Dec 2013

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc