Skip to content

Collapsify inlines all the resources of a page into a single document

Notifications You must be signed in to change notification settings

phuchau1989/collapsify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collapsify Build Status

Inlines all of the JavaScripts, stylesheets, images, fonts etc. of an HTML page.

Installation

npm install -g collapsify

Usage

An HTTP server is installed as collapsify-server, which collapses the URL passed to “/?url=”. This HTTP server is systemd-aware: when running as a systemd service, collapsify will listen on the socket passed. Otherwise, this server defaults to listening on port 8020, which can be changed via the “-p” flag.

Additional options can by found via the built in usage information, collapsify-server -h.

API

var collapsify = require('collapsify');

collapsify('http://www.cloudflare.com', {
  headers: {
    Accept-Language: 'en-US'
  },
}).then(function(output) {
  console.log(output);
});

The “collapsify” function takes the URL to collapse, as well as an object of options, and returns a promise that resolves to a Buffer.

Options

  • headers: An object of headers, to be added to each HTTP request.
  • forbidden: A regex that matches blacklisted resources that should be avoided while navigating.

About

Collapsify inlines all the resources of a page into a single document

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 96.8%
  • Makefile 3.2%