0.4.2 • Published 5 years ago

ts-transform-img v0.4.2

Weekly downloads
36
License
MIT
Repository
github
Last release
5 years ago

ts-transform-img

build status Greenkeeper badge

This is a TypeScript AST Transformer that allows you to write import * as img from 'foo.png'. Depending on file size, the img with be base64-inlined in the source or aggregated via onImgExtracted.

Usage

First of all, you need some level of familiarity with the TypeScript Compiler API.

compile.ts & tests should have examples of how this works. The available options are:

threshold?: number

Threshold of img size that will be inlined, default to 10K

interpolateName?: InterpolateNameFn | string

Function to generate ID for the img asset

onImgExtracted(id: string, filePath: string): void

Function that gets triggered every time we found an asset

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.3

5 years ago

0.2.1

6 years ago

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago