Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fansenze/parcel-transformer-url-loader

📦url loader for parcel, use base64 encode file
https://github.com/fansenze/parcel-transformer-url-loader

base64 parcel parcel-plugin url-loader

Last synced: 2 months ago
JSON representation

📦url loader for parcel, use base64 encode file

Awesome Lists containing this project

README

        

# parcel-transformer-url-loader

**use `base64` encode file in `js` and `css`(includes `sass`/`less` etc.)**

the plugin will unlink file in `production`(parcel env).

## Installation
> if you use **Parcel 1.x**, you should install `[email protected]`.

### npm
```bash
npm i parcel-transformer-url-loader -D
```

### yarn
```bash
yarn add parcel-transformer-url-loader --dev
```

## Usage

### define transformers for parcel

you must define glob in `.parcelrc` to match files for the transformer of `parcel-transformer-url-loader`.

for example:
```json
// .parcelrc
{
"extends": "@parcel/config-default",
"transformers": {
"*.{png,jpg,jpeg}": ["parcel-transformer-url-loader"]
}
}
```

### Configuration

✨✨✨ If you have used `url-loader` in `webpack`, you'll feel familiar with it.

#### there is default options in package.json
```json
{
"parcel-transformer-url-loader": {
"limit": 10240
}
}
```

#### if you want to have your configuration

you can define "parcel-transformer-url-loader" in you `package.json`.

for example:
```json
{
"name": "your project",
"scripts": {},
"parcel-transformer-url-loader": {
"limit": 8888
}
}
```