@mapbox/postcss-html-filter
Advanced tools
Comparing version
# 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 | ||
[](https://travis-ci.org/mapbox/postcss-html-filter) | ||
[](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
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
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
0.2%6
-14.29%153
4.79%+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated