extract-css
Advanced tools
Comparing version 1.0.1 to 1.0.2
19
index.js
@@ -10,6 +10,7 @@ 'use strict'; | ||
module.exports = function (html, options, callback) { | ||
var batch = new Batch(); | ||
var data = getStylesheetList(html, options); | ||
batch.push(function (callback) { | ||
getStylesData(data.html, options, callback); | ||
var batch = new Batch(), | ||
data = getStylesheetList(html, options); | ||
batch.push(function (cb) { | ||
getStylesData(data.html, options, cb); | ||
}); | ||
@@ -20,17 +21,19 @@ if (data.hrefs.length) { | ||
data.hrefs.forEach(function (stylesheetHref) { | ||
batch.push(function (callback) { | ||
getHrefContent(stylesheetHref, options.url, callback); | ||
batch.push(function (cb) { | ||
getHrefContent(stylesheetHref, options.url, cb); | ||
}); | ||
}); | ||
batch.end(function (err, results) { | ||
var stylesData = results.shift(), | ||
css; | ||
if (err) { | ||
return callback(err); | ||
} | ||
var stylesData = results.shift(); | ||
results.forEach(function (content) { | ||
stylesData.css.push(content); | ||
}); | ||
var css = stylesData.css.join('\n'); | ||
css = stylesData.css.join('\n'); | ||
callback(null, stylesData.html, css); | ||
}); | ||
}; |
{ | ||
"name": "extract-css", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Extract the CSS from an HTML document.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "gulp test" | ||
"test": "mocha", | ||
"coverage": "nyc npm test && nyc report", | ||
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls" | ||
}, | ||
@@ -25,13 +27,15 @@ "repository": { | ||
"href-content": "^1.0.0", | ||
"list-stylesheets": "^1.0.0", | ||
"style-data": "^1.0.0" | ||
"list-stylesheets": "^1.1.0", | ||
"style-data": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"gulp": "^3.8.10", | ||
"gulp-jshint": "^1.9.0", | ||
"coveralls": "^2.11.6", | ||
"gulp": "^3.9.0", | ||
"gulp-eslint": "^1.1.1", | ||
"gulp-mocha": "^2.0.0", | ||
"gulp-util": "^3.0.2", | ||
"mocha": "^2.1.0", | ||
"should": "^4.6.2" | ||
"nyc": "^5.6.0", | ||
"should": "^5.2.0" | ||
} | ||
} |
@@ -1,3 +0,5 @@ | ||
# extract-css | ||
# extract-css [![Build Status](https://travis-ci.org/jonkemp/extract-css.svg?branch=master)](https://travis-ci.org/jonkemp/extract-css) [![Coverage Status](https://coveralls.io/repos/jonkemp/extract-css/badge.svg?branch=master&service=github)](https://coveralls.io/github/jonkemp/extract-css?branch=master) | ||
[![NPM](https://nodei.co/npm/extract-css.png?downloads=true)](https://nodei.co/npm/extract-css/) | ||
> Extract the CSS from an HTML document. | ||
@@ -4,0 +6,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7309
5
211
85
8
1
Updatedlist-stylesheets@^1.1.0
Updatedstyle-data@^1.1.0