From b74fbc4178bafc1702696f32931aec3a1b67f8cf Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Tue, 23 Jan 2018 17:53:10 -0500 Subject: [PATCH 1/2] Add a minified version of Pjax to NPM Fixes #108. --- .gitignore | 1 + README.md | 20 ++++++++++++-------- package.json | 9 ++++++--- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 2128eae..561eeb2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ tests/scripts/index.html pjax.js .nyc_output/ +pjax.min.js diff --git a/README.md b/README.md index ec01cff..961305d 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,19 @@ Especially for user that have low bandwidth connection._ ## Installation -You can install pjax from **npm** +- You can install pjax from **npm**: + ```shell + npm install pjax + ``` -```shell -$ npm install pjax -``` - -Pjax can obviously be downloaded directly. - -[https://unpkg.com/pjax/pjax.js](https://unpkg.com/pjax/pjax.js) +- You can also link directly to the [bundle](https://cdn.jsdelivr.net/npm/pjax/pjax.js): + ```html + + ``` + Or the [minified bundle](https://cdn.jsdelivr.net/npm/pjax/pjax.min.js): + ```html + + ``` ## No dependencies diff --git a/package.json b/package.json index a317664..e9049c4 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "files": [ "index.js", "lib", - "pjax.js" + "pjax.js", + "pjax.min.js" ], "devDependencies": { "browserify": "^15.0.0", @@ -32,18 +33,20 @@ "serve": "^6.4.4", "tap-nyc": "^1.0.3", "tap-spec": "^4.1.1", - "tape": "^4.8.0" + "tape": "^4.8.0", + "uglify-js": "^3.3.8" }, "scripts": { "lint": "jscs . && jshint . --exclude-path .gitignore", "standalone": "browserify index.js --standalone Pjax > pjax.js", + "build": "npm run standalone && uglifyjs pjax.js -o pjax.min.js", "build-debug": "browserify index.js --debug --standalone Pjax > pjax.js", "tests": "tape -r ./tests/setup.js './tests/**/*.js'", "test": "npm run lint && npm run tests | tap-spec", "coverage-tests": "npm run tests | tap-nyc", "coverage": "nyc -x \"tests/**\" npm run coverage-tests", "example": "opn http://localhost:3000/example/ && serve -p 3000 .", - "prepublish": "npm run standalone", + "prepublish": "npm run build", "release": "npmpub" } } -- 2.49.1 From 12f3be21fb4cd4814690f9340388e972c5ed5688 Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Tue, 23 Jan 2018 19:35:18 -0500 Subject: [PATCH 2/2] Exclude pjax.min.js fom JSCS --- .jscsrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.jscsrc b/.jscsrc index f548996..27bc03b 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,7 +1,8 @@ { "excludeFiles": [ "node_modules/**", - "pjax.js" + "pjax.js", + "pjax.min.js" ], "fileExtensions": [ ".js" -- 2.49.1