| .small { | ||
| font-size: 11px; | ||
| } | ||
| #openDefinition { | ||
| padding: 3px 5px; | ||
| } | ||
| #introduction { | ||
| margin: 60px 10px 25px; | ||
| } | ||
| footer { | ||
| text-align: center; | ||
| padding: 10px; | ||
| } |
+29
-10
@@ -107,3 +107,3 @@ var fs = require('fs'), | ||
| if(settings.removeClasses == true) { | ||
| $('*').removeAttr('class'); | ||
| $('*').removeAttr('id').removeAttr('class'); | ||
| } | ||
@@ -119,7 +119,14 @@ | ||
| if(stylesheets.length > 0) { | ||
| fs.readFile(stylesheets[0], 'utf8', function(err, css) { | ||
| embedStyles(css); | ||
| stylesheets.shift(); | ||
| inlineStylesheetRecursive(stylesheets, callback); | ||
| }); | ||
| fs.access(stylesheets[0], function(err) { | ||
| if(!err) { | ||
| fs.readFile(stylesheets[0], 'utf8', function(err, css) { | ||
| embedStyles(css); | ||
| stylesheets.shift(); | ||
| inlineStylesheetRecursive(stylesheets, callback); | ||
| }); | ||
| } else { | ||
| console.log('Error: Could not locate stylesheet %s', stylesheets[0]); | ||
| return; | ||
| } | ||
| }); | ||
| } else { | ||
@@ -132,4 +139,4 @@ callback(); | ||
| function makeDirectoryRecursive(dirPath, callback) { | ||
| fs.exists(dirPath, function(exists) { | ||
| if(!exists) { | ||
| fs.access(dirPath, function(err) { | ||
| if(err) { | ||
| fs.mkdir(dirPath, function(err) { | ||
@@ -175,4 +182,16 @@ if (err && err.code == 'ENOENT') { | ||
| for(var i=0; i<data.length; i++) | ||
| style += ' ' + data[i] + ':' + data[data[i]] + ';'; | ||
| // Loop through new rules | ||
| for(var i=0; i<data.length; i++) { | ||
| var currentStyle = style.split(';'); | ||
| for(var j in currentStyle) { | ||
| var styleSplit = currentStyle[j].split(':'); | ||
| // Remove old style | ||
| if(styleSplit[0] && data[i].toLowerCase().trim() == styleSplit[0].toLowerCase().trim()) { | ||
| style = style.replace(currentStyle[j] + ';', ''); | ||
| } | ||
| } | ||
| style += ' ' + data[i] + ':' + data[data[i]] + ';'; | ||
| } | ||
@@ -179,0 +198,0 @@ $elem.attr('style', style.trim()); |
+1
-1
| { | ||
| "name": "inlinecss", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "description": "Inlines stylesheets and style tags into html content", | ||
@@ -5,0 +5,0 @@ "author": "Ripel Labs", |
@@ -11,2 +11,3 @@ <!DOCTYPE html> | ||
| <link rel="stylesheet" href="css/secondary.css" /> | ||
| <link rel="stylesheet" href="css/overwrite.css" /> | ||
| <link rel="stylesheet" href="http://remotedomain.com/stylesheet.css" /> | ||
@@ -13,0 +14,0 @@ <style> |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
15410
5.27%10
11.11%370
8.5%