Search code examples
npmgitignorenpmignore

Make npm ignore folders starting by certain prefix


Right now my .gitignore files has the following rule:

demos/test**

Which seems to be working fine with Git (and github) and ignoring the following folders:

./demos/test-whatever/
./demos/test/

But when publishing to npm, those folders are not ignored and are being published.

Any way to exclude them from npm?


Solution

  • Create a .npmignore file in your root directory and add your demos/test** ignore rule to this file. For reference:

    .npmignore

       demos/test**