Skip to content

Blocks unnecessary resources like images, fonts, and stylesheets to optimize performance and speed up page loads.

Notifications You must be signed in to change notification settings

T2LEAF/t2-puppeteer-plugin-block-resources

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

t2-puppeteer-plugin-block-resources

npm version

Description

Installation

    npm install t2-puppeteer-plugin-block-resources

or using Yarn:

    yarn add t2-puppeteer-plugin-block-resources

Usage with puppeteer-extra

import puppeteerExtra from 'puppeteer-extra';
import blockResources from 't2-puppeteer-plugin-block-resources';

// | "document"
// | "stylesheet"
// | "image"
// | "media"
// | "font"
// | "script"
// | "texttrack"
// | "xhr"
// | "fetch"
// | "eventsource"
// | "websocket"
// | "manifest"
// | "other"

const bl=blockResources()
bl.add(['image','media','stylesheet'])
puppeteerExtra.use(bl);

(async () => {
  const browser = await puppeteerExtra.launch({
    headless:false,
  });
  const page = await browser.newPage();

  await page.setViewport({
    width: 1920,
    height: 1080
});

  await page.goto('https://unsplash.com/')

//   await browser.close();
})();

About

Blocks unnecessary resources like images, fonts, and stylesheets to optimize performance and speed up page loads.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published