ts-transform-img
Version:
Allow `import * as img from 'foo.png'` in TS
21 lines (13 loc) • 960 B
Markdown
//travis-ci.org/longlho/ts-transform-img.svg?branch=master)
[](https://greenkeeper.io/)
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`.
First of all, you need some level of familiarity with the [TypeScript Compiler API](https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API).
`compile.ts` & tests should have examples of how this works. The available options are:
Threshold of img size that will be inlined, default to 10K
Function to generate ID for the img asset
Function that gets triggered every time we found an asset
![build status](https: