New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

postcss-inline-base64

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-inline-base64

PostCSS plugin for encode the file to base64

Source
npmnpm
Version
6.1.0
Version published
Maintainers
1
Created
Source

PostCSS Inline Base64

Node.js CI Coverage Status Snyk badge

PostCSS plugin used to replace value inside of url function to base64

Usage

See the example below

postcss([ require('postcss-inline-base64')(options) ])

Options

NameTypeDefaultDescription
baseDirstringprocess.cwd()Path to load files

Example

Use the syntax below inside url() function:

Variations:

 - url(b64---{file}---)
 - url(b64---'{file}'---)
 - url(b64---"{file}"---)
 - url('b64---{file}---')
 - url("b64---{file}---")

input

@font-face {
  font-family: 'example';
  src: url('b64---./example.woff---') format('woff'), url('b64---./example.woff2---') format('woff2');
  font-weight: normal;
  font-style: normal;
}

body {
  background-color: gray;
  background-image: url('b64---https://cdn.lagden.in/xxx.png---')
}

.notfound {
  background-image: url('b64---https://file.not/found.png---');
}

.ignore {
  background-image: url('https://cdn.lagden.in/mask.png');
}

output

@font-face {
  font-family: 'example';
  src: url('data:font/woff;charset=utf-8;base64,d09...eLAAAA==') format('woff'), url('data:font/woff2;charset=utf-8;base64,d09...eLAAAA==') format('woff2');
  font-weight: normal;
  font-style: normal;
}

body {
  background-color: gray;
  background-image: url('data:image/png;charset=utf-8;base64,iVBORw0K...SuQmCC');
}

.notfound {
  background-image: url('https://file.not/found.png')
}

.ignore {
  background-image: url('https://cdn.lagden.in/mask.png');
}

See PostCSS docs for examples for your environment.

License

MIT © Thiago Lagden

Keywords

postcss

FAQs

Package last updated on 17 Sep 2020

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