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

posthtml-postcss

Package Overview
Dependencies
Maintainers
1
Versions
16
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.2.0 to 0.2.1

35

index.js
/* global Promise */
var postcss = require('postcss');
function indentResolve(str, options) {
if (options.length === undefined) {
if (str.match(/\n(?!\n)\s*/g) === null) {
return str;
}
options.lastLine = str.substr(str.lastIndexOf('\n') + 1);
str = str.substr(0, str.lastIndexOf('\n') + 1);
options.length = Math.min.apply(Math, str.match(/\n(?!\n)\s*/g).filter(function(space) {
return space.length > 2;
}).map(function(space) {
return space.length;
}));
options.match = new Array(options.length).join(' ');
str = str.replace(new RegExp(options.match,'g'), '');
} else {
str = str.replace(/\n/g, '\n' + options.match);
str = str.substr(0, str.lastIndexOf('\n') + 1) + options.lastLine;
}
return str;
}
module.exports = function(plugins, options) {

@@ -14,8 +37,14 @@ plugins = [].concat(plugins);

tree.walk(function(node) {
var promise;
var promise,
indent = {
length: undefined,
match: '',
lastLine: ''
};
if (node.tag === 'style' && node.content) {
promise = css.process([].concat(node.content).join(''), options)
var styles = indentResolve([].concat(node.content).join(''), indent);
promise = css.process(styles, options)
.then(function(result) {
node.content = result.css;
node.content = indentResolve(result.css, indent);
});

@@ -22,0 +51,0 @@

2

package.json
{
"name": "posthtml-postcss",
"version": "0.2.0",
"version": "0.2.1",
"description": "PostHTML-PostCSS plugin. Use PostCSS in HTML document.",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

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