diff --git a/bundled.html b/bundled.html deleted file mode 100644 index 21a2e8e..0000000 --- a/bundled.html +++ /dev/null @@ -1,11 +0,0 @@ -

hi from myHtml

- - - -

line 2

- - - -

line 3

diff --git a/src/inlineImages.js b/src/inlineImages.js index 9b635fc..b9af882 100644 --- a/src/inlineImages.js +++ b/src/inlineImages.js @@ -4,13 +4,13 @@ const fs = require('fs').promises; const path = require('path'); let inlineImages = async htmlPath => { - const imgTagRegex = //; + const imgTagRegex = //; let html = await fs.readFile(htmlPath, 'utf8'); let matches = html.match(new RegExp(imgTagRegex, 'g')); if (!matches) return html; let imgPromises = matches - .map(imgTag => imgTag.match(imgTagRegex)[2]) + .map(imgTag => imgTag.match(imgTagRegex)[2].replace(/^\/+/, '')) .map(relImgPath => path.resolve(path.dirname(htmlPath), relImgPath)) .map(imgPath => fs.readFile(imgPath)); let i = 0; diff --git a/src/inlineScriptTags.js b/src/inlineScriptTags.js index d19699b..81de5b6 100644 --- a/src/inlineScriptTags.js +++ b/src/inlineScriptTags.js @@ -4,13 +4,13 @@ const fs = require('fs').promises; const path = require('path'); let inlineHtmlScripts = async htmlPath => { - const scriptTagRegex = /

line 3

+ + + + diff --git a/test/testInlineStylesheets/index.html b/test/testInlineStylesheets/index.html index 70fad65..1246b59 100644 --- a/test/testInlineStylesheets/index.html +++ b/test/testInlineStylesheets/index.html @@ -9,12 +9,17 @@ Incorrect syntax - Link tags with `rel="stylesheet"` should be replaced. - +Should also work with `rel=stylesheet` (no double quotes) + + Space between attributes is optional +Nesting + +Leading slashes are removed +