All Projects → lagden → postcss-inline-base64

lagden / postcss-inline-base64

Licence: MIT License
PostCSS plugin used to replace value inside of url function to base64

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to postcss-inline-base64

postcss-font-grabber
A postcss plugin, it grabs remote font files and update your CSS, just like that.
Stars: ✭ 26 (+13.04%)
Mutual labels:  postcss, font-face
postcss-flexible
🔲 dpr/rem/url transformer for flexible
Stars: ✭ 19 (-17.39%)
Mutual labels:  url, postcss
Gulp Tutorial
Code examples for my Gulp.js tutorial series
Stars: ✭ 383 (+1565.22%)
Mutual labels:  base64, postcss
utils.js
👷 🔧 zero dependencies vanilla JavaScript utils.
Stars: ✭ 14 (-39.13%)
Mutual labels:  url, base64
Datauri
Generate Data-URI scheme via terminal or node.js
Stars: ✭ 212 (+821.74%)
Mutual labels:  base64, inline
micell
A collection of functions for front-end development
Stars: ✭ 16 (-30.43%)
Mutual labels:  url, base64
postcss-shopify-settings-variables
PostCSS plugin for variable of theme setting in shopify css file.
Stars: ✭ 14 (-39.13%)
Mutual labels:  postcss
secondhand-deal
A campus secondhand trading system based on the vue.js + stylus + koa2 + sequelize ORM + mysql, and typescript is still learning to migrate.🍌
Stars: ✭ 21 (-8.7%)
Mutual labels:  base64
hugo-starter-tailwind-basic
A basic and simple to set up Hugo with TailwindCSS starter project.
Stars: ✭ 80 (+247.83%)
Mutual labels:  postcss
UrlCombine
C# util for combining Url paths. Works similarly to Path.Combine.
Stars: ✭ 23 (+0%)
Mutual labels:  url
quantum-blox
Quantum blox - modular UI boilerplate in react
Stars: ✭ 12 (-47.83%)
Mutual labels:  postcss
doi2bib
📝 Easily convert Digital Object Identifier (DOI) and Uniform Resource Locator (URL) to BibTeX and DOI to plain text.
Stars: ✭ 28 (+21.74%)
Mutual labels:  url
Webpack-Starter-Kit
Webpack 4 stater kit with SCSS, PostCSS, Babel & ESLint
Stars: ✭ 41 (+78.26%)
Mutual labels:  postcss
postcss-combine-duplicated-selectors
automatically keep css selectors unique.
Stars: ✭ 69 (+200%)
Mutual labels:  postcss
postcss-image-set-polyfill
PostCSS plugin for polyfilling image-set CSS function
Stars: ✭ 45 (+95.65%)
Mutual labels:  postcss
wumpfetch
🚀🔗 A modern, lightweight, fast and easy to use Node.js HTTP client
Stars: ✭ 20 (-13.04%)
Mutual labels:  url
soba
Kirby starter theme that uses Twig, PostCSS, and Browsersync
Stars: ✭ 16 (-30.43%)
Mutual labels:  postcss
caesura
📏 A reasonable breakpoint scale using @Custom-Media
Stars: ✭ 14 (-39.13%)
Mutual labels:  postcss
postcss-relaxed-unit
🍮Postcss-relaxed-unit is a postcss plugin for unit tranformation and make write css easier with custom unit.
Stars: ✭ 44 (+91.3%)
Mutual labels:  postcss
fast-base64
Fastest base64 on the web, with Wasm + SIMD
Stars: ✭ 23 (+0%)
Mutual labels:  base64

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

Name Type Default Description
baseDir string process.cwd() Path to load files

Example

Use the syntax below inside url() function:

Variations:

 - b64---{file}---
 - b64---'{file}'---
 - b64---"{file}"---
 - 'b64---{file}---'
 - "b64---{file}---"

input

:root {
  --image: 'b64---./example.gif---';
}

@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(var(--image));
}

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

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

output

:root {
  --image: 'data:image/png;charset=utf-8;base64,iVBORw0K...SuQmCC';
}

@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(var(--image));
}

.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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].