Skip to content

Webpack sqip-loader implemented as babel-plugin-macros

License

Notifications You must be signed in to change notification settings

stereobooster/sqip.macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqip.macro

Build Status Babel Macro

Webpack sqip-loader implemented as babel-plugin-macros

Usage

Similar to nodejs require call:

import sqip from "sqip.macro";

const preview = sqip("./image.jpg");

Example of usage in create-react-app

import coverImage from "./cover-image.jpg";
import sqip from "sqip.macro";
const coversqip = sqip("./cover-image.jpg");

const SomeComponent = () => (
  <div
    style={{
      backgroundImage: `url(${coversqip}`,
      backgroundSize: "cover",
      backgroundRepeat: "no-repeat",
    }}
  >
    <img src={coverImage} alt="" width="100%" height="100%" />
  </div>
);

Credits

Based on pveyes/raw.macro.

License

MIT

About

Webpack sqip-loader implemented as babel-plugin-macros

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •