rakyll / statik

Embed files into a Go executable
Apache License 2.0
3.76k stars 224 forks source link

Argument to exclude given patterns #42

Closed muesli closed 5 years ago

muesli commented 6 years ago

An argument to exclude certain file patterns (like .git) would be nice.

jcchavezs commented 5 years ago

Friendly ping to @marc-gr as he was interested on this.

schivei commented 5 years ago

Instead of exclude files with a pattern, I created a feature that lets you include only certain files using a pattern. This makes it possible, for example, to include only web files (html, css, js, images, fonts) when working on a web project.

For example:

$ statik -src=./ -exts=*.html,*.map,*.json,*.js,*.css,*.ttf,*.woff*,*.otf,*.svg,*.ico,*.gif,*.png,*.jpg

I created this feature with the ease of generating static files and the architecture I use, where my template files are in the same directory as the control codes, just like dotnet core projects (ex: index.html and index .html.go).

jcchavezs commented 5 years ago

To be honest I, most of the time, prefer whitelist over blacklist. In this specific case, we use statik to include files that are in other repository (e.g. json schemas) and that repository has its own stuff: readme, package.json, license, etc. I am in for the extension whitelist. Any opinion @marc-gr @rakyll ?

jcchavezs commented 5 years ago

Closed by https://github.com/rakyll/statik/pull/78