@mapbox/postcss-html-filter
Advanced tools
Comparing version 2.0.0 to 3.0.0
# Changelog | ||
## 3.0.0 | ||
- update dependencies, eslint rules, and travis config. | ||
## 2.0.0 | ||
@@ -4,0 +8,0 @@ |
30
index.js
@@ -10,3 +10,3 @@ 'use strict'; | ||
const plugin = postcss.plugin('postcss-html-filter', (options) => { | ||
const htmlFilterPlugin = (options) => { | ||
const query = cheerio.load(options.html); | ||
@@ -60,15 +60,21 @@ | ||
return (root, result) => { | ||
root.walkRules(transformRule); | ||
return { | ||
postcssPlugin: 'postcss-html-filter', | ||
Once: (root) => { | ||
root.walkRules(transformRule); | ||
return root; | ||
} | ||
} | ||
}; | ||
// Discard any at-rules we've emptied of rules. | ||
postcssDiscardEmpty()(root, result); | ||
const combinedPlugin = (options) => { | ||
return postcss([ | ||
htmlFilterPlugin(options), | ||
postcssDiscardEmpty, // Discard any at-rules we've emptied of rules. | ||
postcssDiscardUnused // Discard unused at-rules, e.g. counter-styles, keyframes, font-faces. | ||
]) | ||
} | ||
// Discard unused at-rules, e.g. counter-styles, keyframes, font-faces. | ||
postcssDiscardUnused()(root, result); | ||
combinedPlugin.postcss = true | ||
return root; | ||
}; | ||
}); | ||
module.exports = plugin; | ||
module.exports = combinedPlugin; |
{ | ||
"name": "@mapbox/postcss-html-filter", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Filter CSS through HTML, removing selectors that do not apply to the HTML", | ||
@@ -33,18 +33,17 @@ "main": "index.js", | ||
"cheerio": "^1.0.0-rc.3", | ||
"lodash": "^4.17.15", | ||
"postcss-discard-empty": "^4.0.1", | ||
"postcss-discard-unused": "^4.0.1", | ||
"postcss-selector-parser": "^6.0.2" | ||
"lodash": "^4.17.20", | ||
"postcss-discard-empty": "^6", | ||
"postcss-discard-unused": "^6", | ||
"postcss-selector-parser": "^6.0.4" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^7.2.0", | ||
"eslint": "^8", | ||
"eslint-plugin-node": "^11.1.0", | ||
"husky": "^4.2.5", | ||
"jest": "^26.0.1", | ||
"lint-staged": "^10.2.10", | ||
"postcss": "^7.0.32", | ||
"prettier": "^2.0.5" | ||
"husky": "^8", | ||
"jest": "^26.6.3", | ||
"lint-staged": "^11", | ||
"prettier": "^2.1.2" | ||
}, | ||
"peerDependencies": { | ||
"postcss": ">=5.0.0" | ||
"postcss": "^8" | ||
}, | ||
@@ -51,0 +50,0 @@ "prettier": { |
# @mapbox/postcss-html-filter | ||
[![Build Status](https://travis-ci.org/mapbox/postcss-html-filter.svg?branch=main)](https://travis-ci.org/mapbox/postcss-html-filter) | ||
[![Build Status](https://travis-ci.com/mapbox/postcss-html-filter.svg?branch=main)](https://travis-ci.com/mapbox/postcss-html-filter) | ||
@@ -5,0 +5,0 @@ Filter CSS through HTML, removing selectors that do not apply to that HTML. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16692
6
153
+ Addedpostcss-discard-empty@6.0.3(transitive)
+ Addedpostcss-discard-unused@6.0.5(transitive)
- Removeddot-prop@5.3.0(transitive)
- Removedindexes-of@1.0.1(transitive)
- Removedis-obj@2.0.0(transitive)
- Removedpicocolors@0.2.1(transitive)
- Removedpostcss@7.0.39(transitive)
- Removedpostcss-discard-empty@4.0.1(transitive)
- Removedpostcss-discard-unused@4.0.1(transitive)
- Removedpostcss-selector-parser@3.1.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removeduniq@1.0.1(transitive)
- Removeduniqs@2.0.0(transitive)
Updatedlodash@^4.17.20
Updatedpostcss-discard-empty@^6
Updatedpostcss-discard-unused@^6