Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

posthtml-postcss

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthtml-postcss - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

changelog.md

60

index.js

@@ -1,33 +0,33 @@

var postcss = require('postcss')
const postcss = require('postcss');
module.exports = function (plugins, options, filterType) {
plugins = [].concat(plugins).filter(plugin => typeof plugin === 'function')
options = options || {}
plugins = [].concat(plugins).filter(Boolean);
options = options || {};
var css = postcss(plugins)
const css = postcss(plugins);
return function posthtmlPostcss (tree) {
var promises = []
return function (tree) {
const promises = [];
tree.walk(function (node) {
var promise
tree.walk(node => {
let promise;
if (node.tag === 'style' && node.content) {
var meetsFilter = true
let meetsFilter = true;
if (filterType) {
var typeAttr = (node.attrs && node.attrs.type) ? node.attrs.type.trim() : ''
var meetsTypeAttr = filterType.test(typeAttr)
var meetsStandardType = filterType.test('text/css') && (meetsTypeAttr || typeAttr === '')
var meetsOtherType = !meetsStandardType && meetsTypeAttr
meetsFilter = meetsStandardType || meetsOtherType
const typeAttr = (node.attrs && node.attrs.type) ? node.attrs.type.trim() : '';
const meetsTypeAttr = filterType.test(typeAttr);
const meetsStandardType = filterType.test('text/css') && (meetsTypeAttr || typeAttr === '');
const meetsOtherType = !meetsStandardType && meetsTypeAttr;
meetsFilter = meetsStandardType || meetsOtherType;
}
if (meetsFilter) {
var styles = [].concat(node.content).join('')
const styles = [].concat(node.content).join('');
promise = css.process(styles, options)
.then(function (result) {
node.content = [result.css]
})
.then(result => {
node.content = [result.css];
});
promises.push(promise)
promises.push(promise);
}

@@ -38,16 +38,16 @@ }

promise = css.process(node.attrs.style, options)
.then(function (result) {
node.attrs.style = result.css
})
.then(result => {
node.attrs.style = result.css;
});
promises.push(promise)
promises.push(promise);
}
return node
})
return node;
});
return Promise.all(promises).then(function () {
return tree
})
}
}
return Promise.all(promises).then(() => {
return tree;
});
};
};
{
"name": "posthtml-postcss",
"version": "0.3.0",
"description": "PostHTML-PostCSS plugin. Use PostCSS in HTML document.",
"version": "0.4.0",
"description": "PostHTML-PostCSS plugin. Use PostCSS in HTML document",
"license": "MIT",
"repository": "posthtml/posthtml-postcss",
"author": "Ivan Voischev <voischev.ivan@ya.ru>",
"main": "index.js",
"files": ["index.js"],
"engines": {
"node": ">=10"
},
"scripts": {
"test": "npm run lint && npm run coverage",
"version": "conventional-changelog -i changelog.md -s -r 0 && git add changelog.md",
"test": "c8 mocha --timeout 5000",
"lint": "eslint {test/*,*}.js",
"coverage": "istanbul cover --report text --report html --report lcov node_modules/mocha/bin/_mocha",
"preversion": "npm test",
"postversion": "git push && git push --tags && rm -rf coverage"
"pretest": "clinton"
},
"repository": {
"type": "git",
"url": "git+https://github.com/posthtml/posthtml-postcss.git"
},
"files": [
"index.js"
],
"keywords": [

@@ -33,36 +36,19 @@ "posthtml",

],
"author": "Ivan Voischev <voischev.ivan@ya.ru>",
"license": "MIT",
"bugs": {
"url": "https://github.com/posthtml/posthtml-postcss/issues"
"dependencies": {
"postcss": "^8.0.0"
},
"homepage": "https://github.com/posthtml/posthtml-postcss#readme",
"devDependencies": {
"autoprefixer": "^9.6.5",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-angular": "^11.0.0",
"autoprefixer": "^10.0.2",
"c8": "^7.3.5",
"chai": "^4.2.0",
"eslint": "^6.5.1",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"istanbul": "^0.4.0",
"mocha": "^6.2.2",
"posthtml": "^0.12.0"
},
"dependencies": {
"postcss": "^7.0.18"
},
"eslintConfig": {
"env": {
"node": true,
"mocha": true
},
"plugins": [
"standard"
],
"extends": [
"standard"
]
"clinton": "^0.14.0",
"conventional-changelog-cli": "^2.1.1",
"husky": "^4.3.0",
"lint-staged": "^10.5.1",
"mocha": "^8.2.1",
"posthtml": "^0.13.4",
"xo": "^0.34.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc