@bradymholt/ampify
Advanced tools
Comparing version 1.0.0 to 1.1.0
10
index.js
@@ -133,5 +133,9 @@ const fs = require("fs"); | ||
if (src.indexOf("//") === -1) { | ||
const image = `${options.cwd}/${$(element).attr("src")}`; | ||
if (fs.existsSync(image)) { | ||
const size = sizeOf(image); | ||
let imagePath = `${options.cwd}/${$(element).attr("src")}`; | ||
if (imagePath.includes("#")) { | ||
// Remove hash fragment from src | ||
imagePath = imagePath.split("#")[0]; | ||
} | ||
if (fs.existsSync(imagePath)) { | ||
const size = sizeOf(imagePath); | ||
$(element).attr({ | ||
@@ -138,0 +142,0 @@ width: round(size.width), |
{ | ||
"name": "@bradymholt/ampify", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -1,2 +0,2 @@ | ||
# ampify | ||
# ampify [![NPM Package](https://img.shields.io/npm/v/@bradymholt/ampify.svg)](https://www.npmjs.com/package/@bradymholt/ampify) | ||
@@ -3,0 +3,0 @@ > Convert plain HTML to Google AMP (Accelerated Mobile Pages) |
14158
261