style-data
Advanced tools
Comparing version 1.0.3 to 1.1.0
19
index.js
'use strict'; | ||
var mediaQueryText = require('mediaquery-text'), | ||
cheerio = require('cheerio'); | ||
cheerio = require('cheerio'), | ||
extend = require('extend'), | ||
pick = require('object-pick'); | ||
module.exports = function (html, options, callback) { | ||
var results = {}, | ||
$ = cheerio.load(html, { | ||
$ = cheerio.load(html, extend({ | ||
decodeEntities: false | ||
}), | ||
}, pick(options, [ | ||
'xmlMode', | ||
'decodeEntities', | ||
'lowerCaseTags', | ||
'lowerCaseAttributeNames', | ||
'recognizeCDATA', | ||
'recognizeSelfClosing' | ||
]))), | ||
styleDataList, | ||
@@ -17,2 +26,4 @@ styleData; | ||
$('style').each(function (index, element) { | ||
var mediaQueries; | ||
styleDataList = element.childNodes; | ||
@@ -29,3 +40,3 @@ if (styleDataList.length !== 1) { | ||
if (options.preserveMediaQueries) { | ||
var mediaQueries = mediaQueryText(element.childNodes[0].nodeValue); | ||
mediaQueries = mediaQueryText(element.childNodes[0].nodeValue); | ||
element.childNodes[0].nodeValue = mediaQueries; | ||
@@ -32,0 +43,0 @@ } else { |
{ | ||
"name": "style-data", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Get the content of style tags.", | ||
"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" | ||
}, | ||
@@ -27,12 +29,16 @@ "repository": { | ||
"cheerio": "^0.19.0", | ||
"mediaquery-text": "^1.0.0" | ||
"extend": "^3.0.0", | ||
"mediaquery-text": "^1.0.0", | ||
"object-pick": "^0.1.2" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^2.11.6", | ||
"gulp": "^3.8.10", | ||
"gulp-jshint": "^1.9.0", | ||
"gulp-eslint": "^1.1.1", | ||
"gulp-mocha": "^2.0.0", | ||
"gulp-util": "^3.0.2", | ||
"mocha": "^2.1.0", | ||
"nyc": "^5.5.0", | ||
"should": "^5.2.0" | ||
} | ||
} |
@@ -1,3 +0,5 @@ | ||
# style-data | ||
# style-data [![Build Status](https://travis-ci.org/jonkemp/style-data.svg?branch=master)](https://travis-ci.org/jonkemp/style-data) [![Coverage Status](https://coveralls.io/repos/jonkemp/style-data/badge.svg?branch=master&service=github)](https://coveralls.io/github/jonkemp/style-data?branch=master) | ||
[![NPM](https://nodei.co/npm/style-data.png?downloads=true)](https://nodei.co/npm/style-data/) | ||
> Get the content of style tags. | ||
@@ -49,3 +51,6 @@ | ||
### cheerio options | ||
Options to passed to [cheerio](https://github.com/cheeriojs/cheerio). | ||
## Credit | ||
@@ -52,0 +57,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
7287
5
221
62
4
8
1
+ Addedextend@^3.0.0
+ Addedobject-pick@^0.1.2
+ Addedextend@3.0.2(transitive)
+ Addedobject-pick@0.1.2(transitive)