Regex pattern to ignore multiple folders

核能气质少年 提交于 2020-06-17 00:14:29

问题


How is the correct syntax to ignore more then one files and folders for electron-packager?

With only one arg like: --ignore=docs/* it works fine. But I want to ignore more then one folder and files like: --ignore=docs/* + dev/* + someFile.js


回答1:


Use the OR statement in the regular expression by using the | character in stead of the + character.

--ignore="docs/.*|dev/.*|somefile\.js"



回答2:


This variant works for me

--ignore=\"(docs*|dev*|somefile\.js)\"




回答3:


For anyone out there who's looking for a simpler way of packaging an Angular application with Electron using electron-packager, this might get you sorted.

$ electron-packager . myapp --out=dist/builds/win --arch=x64 --icon=src/assets/images/win_icon.ico --asar --overwrite --ignore="(node_modules*|dist/builds*|dist/installers*|e2e*|src*)"

It works for me all the time, I use the terminal from VS Code.



来源:https://stackoverflow.com/questions/41039480/regex-pattern-to-ignore-multiple-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!