skip to Main Content

I can see that the Lighthouse CLI accepts a --blocked-url-patterns argument, but I can’t find any definition of what constitutes a valid pattern, only that * is supported.

Is * literally the only supported pattern-ish character?

2

Answers


  1. In this Google Lighthouse test file blockedUrlPatterns is an array of string with various patterns.

    blockedUrlPatterns: ['http://*.evil.com', '.jpg', '.woff2'],
    
    Login or Signup to reply.
  2. I realise this is coming in a little (two years) late, but for anyone else who wants to pass block patterns using the CLI you need to pass each pattern as its own param:

    lighthouse https://example.com --blocked-url-patterns='http://*.evil.com' --blocked-url-patterns='*.jpg'
    

    This will create the array required by Lighthouse – which you can see in the report produced if you search for blockedUrlPatterns

    "blockedUrlPatterns":["http://*.evil.com","*.jpg"]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search