From 7c900f528508c87a2b8b06d2e507ec2ff5ae8f58 Mon Sep 17 00:00:00 2001 From: Ed Bennett Date: Tue, 21 May 2019 22:29:10 +0100 Subject: [PATCH 1/6] Add package lock --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a088b6f..5c26ec5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules bower_components +package-lock.json \ No newline at end of file From ff90b298c2257dade394af3af8191ed4ac6ae540 Mon Sep 17 00:00:00 2001 From: Ed Bennett Date: Tue, 21 May 2019 22:29:56 +0100 Subject: [PATCH 2/6] Add modifications to changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9119e89..5b71e54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.1.0 Updates +- Update `npm` modules +- Update `cave.js` to use latest dependencies +- Add option to API to compress output + # 2.0.0 Synchronous T-Rex - Change public API to a synchronous one From a4f7d7305227f5a77730b3ecc9792ffe1570614b Mon Sep 17 00:00:00 2001 From: Ed Bennett Date: Tue, 21 May 2019 22:30:21 +0100 Subject: [PATCH 3/6] Amend readme to point out this version is modified --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index f11b4f8..9959ecf 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +# Forked from original by [bevacqua/cav][2] +Updated and maintained by Ed Bennett for personal usage. See [changelog][3] for my modifications. + # cave > Remove critical CSS from your stylesheet after inlining it in your pages @@ -51,3 +54,5 @@ npm test MIT [1]: https://github.com/pocketjoso/penthouse +[2]: https://github.com/bevacqua/cave +[3]: CHANGELOG.md From 7d908f474ae66c2961f73a4a13309f31ad1828bc Mon Sep 17 00:00:00 2001 From: Ed Bennett Date: Tue, 21 May 2019 22:30:55 +0100 Subject: [PATCH 4/6] Version bump to 2.1.0. Add compress option to API. --- package.json | 22 +++++++++++----------- src/cave.js | 7 ++++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 97c090d..a7e4d1e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cave", "description": "Remove critical CSS from your stylesheet after inlining it in your pages", - "version": "2.0.0", + "version": "2.1.0", "homepage": "https://github.com/bevacqua/cave", "author": { "name": "Nicolas Bevacqua", @@ -21,34 +21,34 @@ "test": "node test/cave" }, "devDependencies": { - "browserify": "^4.2.1", + "browserify": "^16.2.3", "contra": "^1.6.10", - "glob": "^4.0.6", - "gulp": "^3.6.2", - "gulp-bump": "~0.1.0", + "glob": "^7.1.4", + "gulp": "^4.0.2", + "gulp-bump": "^3.1.3", "gulp-clean": "~0.2.3", "gulp-concat": "~2.1.7", "gulp-git": "~0.2.0", "gulp-header": "^1.0.2", - "gulp-jshint": "~1.3.4", - "gulp-mocha": "~0.3.0", + "gulp-jshint": "^2.1.0", + "gulp-mocha": "^6.0.0", "gulp-rename": "~0.2.2", "gulp-size": "~0.1.1", "gulp-streamify": "0.0.5", - "gulp-uglify": "~0.1.0", + "gulp-uglify": "^3.0.2", "gzip-size": "^1.0.0", - "jshint": "~2.4.1", + "jshint": "^2.10.2", "jshint-stylish": "~0.1.5", "jshint-tap": "0.0.1", "pretty-bytes": "^1.0.1", "sizzle": "*", - "tape": "^3.0.0", + "tape": "^4.10.1", "vinyl-source-stream": "^0.1.1" }, "dependencies": { "css": "^2.1.0", "get-stdin": "^3.0.0", - "lodash": "^2.4.1", + "lodash": "^4.17.11", "minimist": "^1.1.0" } } diff --git a/src/cave.js b/src/cave.js index 8b591fd..8a7a770 100644 --- a/src/cave.js +++ b/src/cave.js @@ -8,6 +8,7 @@ function api (stylesheet, options) { var sheet = css.parse(read(stylesheet)); var sheetRules = sheet.stylesheet.rules; var removables = css.parse(options.css); + var compressCss = options.compress; removables.stylesheet.rules.forEach(inspectRule); _.forEachRight(sheetRules, removeEmptyMedia); @@ -23,8 +24,8 @@ function api (stylesheet, options) { if (inspected.type === 'rule') { if (parent) { _(sheetRules) - .where({ type: 'media', media: parent.media }) - .pluck('rules') + .filter({ type: 'media', media: parent.media }) + .map('rules') .value() .forEach(removeMatches); } else { @@ -63,7 +64,7 @@ function api (stylesheet, options) { } function result () { - return css.stringify(sheet) + '\n'; + return css.stringify(sheet, {compress: (compressCss == null || compressCss == undefined) ? true : compressCss ? true : false}) + '\n'; } } From e000be795bcd44b6daa380c5779d25fca5e53298 Mon Sep 17 00:00:00 2001 From: Ed Bennett Date: Tue, 21 May 2019 23:03:04 +0100 Subject: [PATCH 5/6] Remove modification message to allow for merge --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 9959ecf..363a2a3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ -# Forked from original by [bevacqua/cav][2] -Updated and maintained by Ed Bennett for personal usage. See [changelog][3] for my modifications. - # cave > Remove critical CSS from your stylesheet after inlining it in your pages From 63c79b29361f8ba48a296c925ffc55db6f54cd34 Mon Sep 17 00:00:00 2001 From: Ed Bennett Date: Tue, 21 May 2019 23:05:32 +0100 Subject: [PATCH 6/6] Remove modification message to allow for merge --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 363a2a3..941ddcc 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,4 @@ npm test MIT -[1]: https://github.com/pocketjoso/penthouse -[2]: https://github.com/bevacqua/cave -[3]: CHANGELOG.md +[1]: https://github.com/pocketjoso/penthouse \ No newline at end of file