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

inline-css

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inline-css - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

55

lib/inline-css.js

@@ -12,2 +12,28 @@ 'use strict';

var tableStyleAttrMap = {
'table': {
'float': 'align',
'background-color': 'bgcolor',
'width': 'width',
'height': 'height'
},
'tr': {
'background-color': 'bgcolor',
'vertical-align': 'valign',
'text-align': 'align'
},
'td,th': {
'background-color': 'bgcolor',
'width': 'width',
'height': 'height',
'vertical-align': 'valign',
'text-align': 'align',
'white-space': 'nowrap'
},
'tbody,thead,tfoot': {
'vertical-align': 'valign',
'text-align': 'align'
}
};
module.exports = function (html, css, options) {

@@ -97,2 +123,9 @@ var rules = parseCSS(css),

for (var i in el.styleProps) {
// add !important
if (typeof el.styleProps[i].selector.spec !== 'undefined') {
if (el.styleProps[i].selector.spec[0] === 2) {
el.styleProps[i].value = el.styleProps[i].value + ' !important';
}
}
style.push(el.styleProps[i].prop + ': ' + el.styleProps[i].value.replace(/["]/g, '\'') + ';');

@@ -136,2 +169,12 @@ }

function applyStylesAsProps($el, styleToAttrMap) {
for (var style in styleToAttrMap) {
var styleVal = $el.css(style);
if (styleVal != undefined) {
$el.attr(styleToAttrMap[style], styleVal);
$el.css(style, '');
}
}
}
function setTableAttrs(index, el) {

@@ -149,2 +192,14 @@ var $el = $(el);

}
for (var selector in tableStyleAttrMap){
if (selector == 'table'){
applyStylesAsProps($el, tableStyleAttrMap['table']);
} else {
$el.find(selector).each(function(i, childEl){
applyStylesAsProps($(childEl), tableStyleAttrMap[selector]);
});
}
}
}

@@ -151,0 +206,0 @@

2

package.json
{
"name": "inline-css",
"version": "2.0.0",
"version": "2.1.0",
"description": "Inline css into an html file.",

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

# inline-css [![npm](http://img.shields.io/npm/v/inline-css.svg?style=flat)](https://badge.fury.io/js/inline-css) [![Build Status](https://travis-ci.org/jonkemp/inline-css.svg?branch=master)](https://travis-ci.org/jonkemp/inline-css)
[![NPM](https://nodei.co/npm/inline-css.png?downloads=true)](https://nodei.co/npm/inline-css/)
> Inline your CSS properties into the `style` attribute in an html file. Useful for emails.

@@ -145,3 +147,3 @@

Type: `Boolean`
Type: `Boolean`
Default: `false`

@@ -148,0 +150,0 @@

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