Skip to content

Commit

Permalink
fix: support url with port
Browse files Browse the repository at this point in the history
  • Loading branch information
AKharytonchyk authored and AKharytonchyk committed Aug 5, 2020
1 parent 264cd4f commit ce76e28
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/get-critical-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ const args = yargs
.demandOption(['url', 'output']).argv;

function getFileName(props) {
const { url, width, height } = props;
let fileName = url
.replace(/http?(s):\/\//i, '')
.replace(/\?.+/, '')
.replace(/\//g, '.');
const { url } = props;
const fileName = url.replace(/https?:\/\/|\/$/ig,'').replace(/:|\//gi, '_');

if (width && height) fileName = ''.concat(fileName, '.', width, 'x', height);

return fileName.concat('.css').replace(/\.\./g, '.');
console.log(fileName.concat('.css'));
return fileName.concat('.css');
};


Expand Down

0 comments on commit ce76e28

Please sign in to comment.