1.0.0 • Published 7 years ago

pico-transforms v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

pico-transforms

A collection of small, but useful Browserify transforms

npm install pico-transforms

const browserify = require('browserify');
const yamlify = require('pico-transforms/yamlify');
const svgify = require('pico-transforms/svgify');

const b = browserify('input.jsx')
	.transform(yamlify)
	.transform(svgify);

b.bundle((err, buf)=>{
	fs.writeFileSync('output.js', buff);
});

yamlify

inspired by yamlify

Allows you to require YAML files when using browserify to have then translated to JSON on the fly.

svgify

inspired by svg-reactify

Allows you to require SVG files when using browserify to have them translated into React components on the fly.

  • Uses functional React components
  • Transpiles it using babel
  • Optimizes the SVG using svgo
  • Strips out any style tags that would cause react parsing issues (may lose coloring, fixed by exporting SVG with 'inline-styles' selected)
  • Can pass className and style as props