Skip to content

Instantly share code, notes, and snippets.

jcompressor

jcompressor is A Closure Compliler-based JavaScript compressor (node package) that compresses all .js files in the current directory (JRE, Node.js and npm is required).

Usage

Install jcompressor

npm install -g jcompressor

Compress

@lichgo
lichgo / jsLoader.js
Last active December 15, 2015 15:59
As browsers parse and render page code sequentially, the parsing and execution of Javascript (whether inline or external) code might block rendering the page and downloading other resources (e.g. images) if the js code was not properly placed. Creating dynamic script elements, due to its intrinsic asynchronous loading pattern, has been widely re…
//Dynamically load js files, taking an array.
function loadJS(fileList) {
var i = 0,
doc = document,
h = doc.getElementsByTagName('head')[0];
l(i);
function l(i) {
var js = doc.createElement('script');