Skip to content

nickdeis/lzstring-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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");

About

lz-string for webpack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published