go.rice icon indicating copy to clipboard operation
go.rice copied to clipboard

feature request: Support exclude(ignore) using .riceignore

Open at15 opened this issue 9 years ago • 7 comments

Similar issues: #80 #37

go.rice does not support excluding files and this result in huge binary if you have folders like node_modules, and due to the way rice find boxes (related #47 ), it's hard to specify different box location for same box during development and production. So similar to git and docker, which has .gitignore and .dockeringore, a .riceignore file can be introduced to make rice more flexible without changing how rice find boxes.

The implementation in docker for dockerignore can be a good start, also there is a dockerignore library

I have already tried it in my own fork in this commit. It works for append zip only, and use the library mentioned above, it works for this small project. Though the behavior is not exactly same as gitingore and only .riceignore file at box root is supported.

I can make a pull request if go.rice is still under development. Thanks~

at15 avatar Aug 21 '16 10:08 at15

This would be a great feature, currently having to manually edit my rice-box.go to remove DS_STORE files and others

ThomasDotCodes avatar Jun 12 '17 19:06 ThomasDotCodes

Has this been implemented?

nadilas avatar Feb 24 '18 09:02 nadilas

@at15 If you're still interested in making a PR for this, it would be very welcome. I think to keep things simple a .riceignore file should only be valid in the root of a box, and is only valid for that box. Absolute paths in the .riceignore file are relative to the root of the box.

Perhaps we should try to follow the gitignore guidelines for pattern matching. https://git-scm.com/docs/gitignore Go has it's own filepath pattern matching as well, but that doesn't seem to support ** for subdirectories? https://golang.org/pkg/path/filepath/#Match

GeertJohan avatar Dec 29 '18 18:12 GeertJohan

No, please, not an ignore option, or at least also provide a include-only thing. rice is embedding my project's .git directory by default. This is a terrible default behavior.

mdione-cloudian avatar Mar 17 '20 16:03 mdione-cloudian

@mdone-cloudian Is your .git directory in the assets box you're embedding?

GeertJohan avatar Apr 20 '20 19:04 GeertJohan

Please be patient, it will take me a couple of days until I can revisit this and give input. We're in release mode here at $WORK.

mdione-cloudian avatar Apr 21 '20 09:04 mdione-cloudian

[Two months later...] Ok, the way I solved it (and I guess it was the original intended method) was to put the files in its own subdir and point rice to it. I find all the example show this, so I guess it was more an error on my side. It's all good now, forget I ever said anything :)

mdione-cloudian avatar May 27 '20 07:05 mdione-cloudian