Coder Social home page Coder Social logo

parcel-plugin-css-url-loader's Introduction

parcel-plugin-css-url-loader

A plugin for parcel to convert css/less/scss url into base64

Install

yarn add parcel-plugin-css-url-loader --dev # or
npm install parcel-plugin-css-url-loader --save-dev

Usage

// .parcelrc
{
  "css-url-loader": {
    "exts": ["png", "svg", "jpg", "gif"],
    "limit": 1000    //kb
  }
}

parcel-plugin-css-url-loader's People

Contributors

dependabot[bot] avatar dmitry-guryev avatar shoonia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

parcel-plugin-css-url-loader's Issues

Checking and removing query params and URL hash (#)

Hey!
I used this plugin and it works well. But I have a little bug with it.

I used the service IcoMoon for creating a font icon. And IcoMoon automatically created me a file with CSS and fonts. This file looks like:

@font-face {
  font-family: 'icomoon';
  src: url('fonts/icomoon.woff?en5820') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

I set up plugin .parcelrc

{
  "css-url-loader": {
    "exts": ["woff"],
    "limit": 10000
  }
}

The plugin works well and return me a base64 with correctly meme type

@font-face {
    font-family: icons;
    src: url(data:font/woff;base64,d09GR ... AAA?en5820) format("woff");
    font-weight: 400;
    font-style: normal;
    font-display:block
}

But in the end, keeps the query parameters ?en5820 and as a result I have invalid base64.

I removed query param in the source and the plugin builds valid base64.

I guess it will be useful added checking and removing query params and URL hash too.

If you let me I can fix it.

I will be grateful for any answer.
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.