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 1.0.1 to 1.0.2

1

index.js

@@ -24,2 +24,3 @@ 'use strict';

} catch (err) {
console.log(err);
callback(err);

@@ -26,0 +27,0 @@ }

26

lib/inline-css.js

@@ -48,12 +48,18 @@ 'use strict';

var name = style[i],
value = style[name],
sel = style._importants[name] ? importantSelector : selector,
prop = new Property(name, value, sel);
value = style[name],
sel = style._importants[name] ? importantSelector : selector,
prop = new Property(name, value, sel),
existing = el.styleProps[name],
winner,
loser;
if ($(el).attr('style')) {
var currentStyle = $(el).attr('style');
$(el).attr('style', currentStyle + ' ' + prop);
if (existing) {
winner = existing.compare(prop);
loser = prop === winner ? existing : prop;
if (winner === prop) {
el.styleProps[name] = prop;
}
} else {
el.styleProps[name] = prop;
$(el).attr('style', prop);
el.styleProps[name] = prop;
}

@@ -68,3 +74,3 @@ }

if ($(el).attr('style')) {
var cssText = '* { ' + el.getAttribute('style') + ' } ';
var cssText = '* { ' + $(el).attr('style') + ' } ';
addProps(parseCSS(cssText)[0][1], styleSelector);

@@ -92,3 +98,3 @@ }

});
//el.setAttribute('style', style.join(' '));
$(el).attr('style', style.join(' '));
}

@@ -95,0 +101,0 @@

{
"name": "inline-css",
"version": "1.0.1",
"version": "1.0.2",
"description": "Inline css into an html file.",

@@ -14,3 +14,3 @@ "main": "index.js",

"scripts": {
"test": "'echo \"Error: no test specified\" && exit 1'"
"test": "gulp test"
},

@@ -32,3 +32,11 @@ "repository": {

},
"homepage": "https://github.com/jonkemp/inline-css"
"homepage": "https://github.com/jonkemp/inline-css",
"devDependencies": {
"gulp": "^3.8.10",
"gulp-jshint": "^1.9.0",
"gulp-mocha": "^2.0.0",
"gulp-util": "^3.0.2",
"mocha": "^2.1.0",
"should": "^4.6.1"
}
}

@@ -7,2 +7,9 @@ # inline-css

## Why inline-css instead of Juice?
- Uses [cheerio](https://github.com/cheeriojs/cheerio) instead of jsdom
- Works on Windows
- Preserves Doctype
- Modular
- Gets your CSS automatically through style and link tags
## How It Works

@@ -66,3 +73,3 @@

inlineCss('/path/to/file.html', function(err, html) {
inlineCss('/path/to/file.html', options, function(err, html) {
console.log(html);

@@ -74,3 +81,3 @@ });

### inlineCss(options)
### inlineCss(html, options, callback)

@@ -117,2 +124,9 @@

#### options.url
Type: `String`
Default: `filePath`
How to resolve hrefs. Required.
#### options.preserveMediaQueries

@@ -119,0 +133,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