+11
-5
@@ -81,5 +81,9 @@ var fs = require('fs'), | ||
| // Check options defaults | ||
| options.decodeEntities = (typeof options.decodeEntities == 'undefined' ? true : options.decodeEntities); | ||
| options.inlineStyleTags = (typeof options.inlineStyleTags == 'undefined' ? true : options.inlineStyleTags); | ||
| for(var prop in settings) { if(typeof options[prop] !== 'undefined') settings[prop] = options[prop]; } | ||
| $ = cheerio.load(html, { decodeEntities: false }); | ||
| $ = cheerio.load(html, { decodeEntities: options.decodeEntities }); | ||
@@ -98,6 +102,8 @@ var stylesheets = []; | ||
| // Loop through embedded style tags | ||
| $('style').each(function(i, elem) { | ||
| embedStyles($(this).text()); | ||
| $(this).remove(); | ||
| }); | ||
| if(options.inlineStyleTags) { | ||
| $('style').each(function(i, elem) { | ||
| embedStyles($(this).text()); | ||
| $(this).remove(); | ||
| }); | ||
| } | ||
@@ -104,0 +110,0 @@ if(settings.removeClasses == true) { |
+1
-1
| { | ||
| "name": "inlinecss", | ||
| "version": "1.1.2", | ||
| "version": "1.1.3", | ||
| "description": "Inlines stylesheets and style tags into html content", | ||
@@ -5,0 +5,0 @@ "author": "Ripel Labs", |
+12
-0
@@ -52,2 +52,14 @@ # inlineCSS | ||
| #### options.decodeEntities | ||
| Decode HTML entities. Eg: `& -> &` | ||
| Type: `Boolean` | ||
| Default: `true` | ||
| #### options.inlineStyleTags | ||
| Inline content in `<style>` tags found in the HTML document | ||
| Type: `Boolean` | ||
| Default: `true` | ||
| #### options.removeClasses | ||
@@ -54,0 +66,0 @@ Remove class attributes |
+1
-1
@@ -7,3 +7,3 @@ var inlineCSS = require('../index'), | ||
| inlineCSS.inlineFile(inFile, outFile, function() { | ||
| inlineCSS.inlineFile(inFile, outFile, { decodeEntities: false }, function() { | ||
| console.log('Test: Inlining file'); | ||
@@ -10,0 +10,0 @@ console.log('----------------------------------'); |
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
16108
3.5%373
1.36%77
18.46%