postcss-background-inline-base64

PostCSS plugin for encode the image file to base64.

Usage no npm install needed!

<script type="module">
  import postcssBackgroundInlineBase64 from 'https://cdn.skypack.dev/postcss-background-inline-base64';
</script>

README

postcss-background-inline-base64

The PostCSS plugin to insert base64 embedded backgrounds


Usage


.pageLoading {
  min-height: 200px;
  background-image: url("./loader.gif") /*b64*/;
  background-position: center 30px;
  background-repeat: no-repeat;
}

The line

background-image: url("./loader.gif") /*b64*/;

will be replaced with the

background-image: url("data:image/gif;charset=utf-8;base64,...");

You can use either background or background-image directives.