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

inline-source

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inline-source - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

12

index.js

@@ -12,5 +12,6 @@ var path = require('path')

* Parse 'html' for <script> and <link> tags containing an 'inline' attribute
* @param {String} htmlpath
* @param {String} html
*/
module.exports = function(html) {
module.exports = function(htmlpath, html) {
var match;

@@ -20,3 +21,3 @@

while (match = RE_INLINE_SOURCE.exec(html)) {
html = inline('js', match[1], html);
html = inline('js', match[1], htmlpath, html);
}

@@ -26,3 +27,3 @@

while (match = RE_INLINE_HREF.exec(html)) {
html = inline('css', match[1], html);
html = inline('css', match[1], htmlpath, html);
}

@@ -37,6 +38,7 @@

* @param {String} source
* @param {String} htmlpath
* @param {String} html
* @returns {String}
*/
function inline(type, source, html) {
function inline(type, source, htmlpath, html) {
var isCSS = (type == 'css')

@@ -46,3 +48,3 @@ , tag = isCSS ? 'style' : 'script'

// Parse url
, filepath = path.resolve(source.match(isCSS ? RE_HREF : RE_SRC)[1])
, filepath = path.resolve(path.extname(htmlpath).length ? path.dirname(htmlpath) : htmlpath, source.match(isCSS ? RE_HREF : RE_SRC)[1])
, filecontent;

@@ -49,0 +51,0 @@

{
"name": "inline-source",
"description": "Inline all flagged js & css source files",
"version": "0.2.0",
"version": "0.3.0",
"author": "popeindustries <alex@pope-industries.com>",

@@ -6,0 +6,0 @@ "keywords": ["inline", "html", "js", "css"],

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