lz-string for webpack
JavaScript
Switch branches/tags
Nothing to show
Clone or download
nickdeis Update README.md
Added to npm
Latest commit 7cadfbd Nov 28, 2015
Permalink
Failed to load latest commit information.
test Added more testing and encodings Nov 27, 2015
LICENSE Initial commit Nov 12, 2015
README.md Update README.md Nov 27, 2015
index.js Added more testing and encodings Nov 27, 2015
package.json Added more testing and encodings Nov 27, 2015

README.md

lzstring-loader

lz-string for webpack

Compresses a string and then decompresses it at runtime Ideal for large JSONs and large CSS files when gzip or serverside compression is not an option.

npm install lzstring-loader

Usage

Plain old string

var string = require("lzstring!./a.txt");

JSON (with json-loader)

var json = require("lzstring!json!./a.json");

CSS (with style-loader)

require("style!lzstring!./a.css");

Use other lzstring methods with the query param to

require("style!lzstring?to=utf16!./a.css");

Query params

to

The default is (compress/decompress)(To/From)Base64

  • base64: (compress/decompress)(To/From)Base64
  • utf16: (compress/decompress)(To/From)UTF16
  • webkit-utf16: (compress/decompress)
  • uri: (compress/decompress)(To/From)EncodedURIComponent
  • uint8: (compress/decompress)(To/From)Uint8Array

TODO

Add support for script-loader

Make json-loading a bit more polymorphic

eg:

var json = require("json!lzstring!./a.json");