Skip to content

Creates LQIP at build time, similar to webpack lqip-loader

License

Notifications You must be signed in to change notification settings

stereobooster/lqip.macro

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Creates LQIP at build time, similar to webpack lqip-loader

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%