diff --git a/helpers/file.js b/helpers/file.js index efb27793..e536a470 100644 --- a/helpers/file.js +++ b/helpers/file.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const slash = require('slash'); const crypto = require('crypto'); const fileUrl = require('file-url'); const constants = require('../config/constants'); @@ -124,6 +125,10 @@ const addHashPostfixToImages = savedImages => { ); }; +const convertBackslashPathToSlashPath = backSlashPath => { + return slash(backSlashPath); +}; + const saveHtmlShell = (imagePath, options, isUrl) => { const imageUrl = isUrl ? imagePath : getFileUrlOfPath(imagePath); const htmlContent = constants.SHELL_HTML_FOR_LOGO( @@ -137,6 +142,7 @@ const saveHtmlShell = (imagePath, options, isUrl) => { module.exports = { addHashPostfixToImages, + convertBackslashPathToSlashPath, saveHtmlShell, isHtmlFile, isImageFile, diff --git a/helpers/pwa.js b/helpers/pwa.js index 8293488b..2f7a3d63 100644 --- a/helpers/pwa.js +++ b/helpers/pwa.js @@ -9,8 +9,10 @@ const generateIconsContentForManifest = (savedImages, manifestJsonPath) => { ) .map(({ path, width, height }) => ({ src: manifestJsonPath - ? file.getRelativeFilePath(manifestJsonPath, path) - : path, + ? file.convertBackslashPathToSlashPath( + file.getRelativeFilePath(manifestJsonPath, path), + ) + : file.convertBackslashPathToSlashPath(path), sizes: `${width}x${height}`, type: `image/${file.getExtension(path)}`, })); @@ -24,7 +26,11 @@ const generateAppleTouchIconHtml = (savedImages, indexHtmlPath) => { .map(({ width, path }) => constants.APPLE_TOUCH_ICON_META_HTML( width, - indexHtmlPath ? file.getRelativeFilePath(indexHtmlPath, path) : path, + indexHtmlPath + ? file.convertBackslashPathToSlashPath( + file.getRelativeFilePath(indexHtmlPath, path), + ) + : file.convertBackslashPathToSlashPath(path), ), ) .join(''); @@ -39,7 +45,11 @@ const generateAppleLaunchImageHtml = (savedImages, indexHtmlPath) => { constants.APPLE_LAUNCH_SCREEN_META_HTML( width, height, - indexHtmlPath ? file.getRelativeFilePath(indexHtmlPath, path) : path, + indexHtmlPath + ? file.convertBackslashPathToSlashPath( + file.getRelativeFilePath(indexHtmlPath, path), + ) + : file.convertBackslashPathToSlashPath(path), scaleFactor, orientation, ), diff --git a/package.json b/package.json index 9cf631bb..52075d23 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,8 @@ "lodash.isequal": "^4.5.0", "lodash.uniqwith": "^4.5.0", "meow": "^5.0.0", - "puppeteer": "^1.19.0" + "puppeteer": "^1.19.0", + "slash": "^3.0.0" }, "devDependencies": { "@jedmao/semantic-release-npm-github-config": "^1.0.6",