lqip.macro

0.1.5 • Public • Published

lqip.macro

Build Status Babel Macro

Webpack lqip-loader implemented as babel-plugin-macros

Usage

Similar to nodejs require call:

import lqip from "lqip.macro";
 
const preview = lqip("./image.jpg");

Example of usage in create-react-app

import coverImage from "./cover-image.jpg";
import lqip from "lqip.macro";
const coverLqip = lqip("./cover-image.jpg");
 
const SomeComponent = () => (
  <div
    style={{
      backgroundImage: `url(${coverLqip}`,
      backgroundSize: "cover",
      backgroundRepeat: "no-repeat"
    }}>
    <img src={coverImage} alt="" width="100%" height="100%"/>
  </div>
);

Credits

Based on pveyes/raw.macro.

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.5
    311
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.5
    311
  • 0.1.4
    0
  • 0.1.3
    0
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i lqip.macro

Weekly Downloads

311

Version

0.1.5

License

MIT

Unpacked Size

16.3 kB

Total Files

10

Last publish

Collaborators

  • stereobooster