-
Notifications
You must be signed in to change notification settings - Fork 0
Home
srivallis edited this page Jun 30, 2021
·
3 revisions
Using Promises, we can run as many as urls we want. In app.js, replace the code with the below snippet:
(async function () {
const extractCriticalCss = require('./extractCriticalCss');
await Promise.all([
extractCriticalCss('https://www.google.com'),
extractCriticalCss('https://www.abc.com'),
extractCriticalCss('https://www.bcd.com'),
extractCriticalCss('https://www.cfgd.com'),
extractCriticalCss('https://www.cndchd.com')
]).then((res) => {
console.log('Critical Css for the pages has been extracted successfully !', res);
}).catch((err) => {
if (err) console.log('An error occured while trying to extract critical css !', err);
});
})();