gatsby-plugin-no-javascript icon indicating copy to clipboard operation
gatsby-plugin-no-javascript copied to clipboard

Need mutiple paths for excluding paths or files

Open ptrobert opened this issue 6 years ago • 5 comments

Need multiple paths for excluding paths or files

We need the ability to exclude multiple paths like partners, contactus etc

ptrobert avatar Oct 20 '19 13:10 ptrobert

can we pass some thing like this currently { resolve:gatsby-plugin-no-javascript, options:{ excludePaths:'/contactus', excludePaths:'/partners', } }

ptrobert avatar Oct 20 '19 14:10 ptrobert

@ptrobert

Thank you for the feedback, I will look at implementing this feature tonight.

itmayziii avatar Oct 24 '19 17:10 itmayziii

I just discovered this plugin (thanks for making it!). From what I can tell, excludePaths is used like a regex, similar to excludeFiles. So I think @ptrobert you can get what you are after with excludePaths: '(/contactus|/partners)'

The README says excludePaths is an array of strings, but I don't think that is correct.

city41 avatar Aug 20 '20 02:08 city41

@city41 Hello , can you please tell me how can i use this excludePaths , lets say i have a page www.mysite.de/foo/bar/

and i only want to keep JS for this page only in my website , is this possible? i tried

 {
      resolve: 'gatsby-plugin-no-javascript',
      options: {
        excludePaths: '/foo',
         // excludePaths: 'foo',
        //  excludePaths: '/foo/bar',
        // excludePaths: '/foo/bar/',
      },
    }
    
    but seems like its not working .

ahmadkhalaf1 avatar Feb 01 '21 14:02 ahmadkhalaf1

Here's an example of using multiple values in excludePaths:

{
  resolve: "gatsby-plugin-no-javascript",
  options: {
    excludePaths: [
      "blog/(index.+)?$",
      "404",
      "error",
      "support/?$",
      "contact/?$"
    ]
    .map(path => `(${path})`)
    .join("|")
  }
}

mykeels avatar Dec 16 '21 19:12 mykeels