mirror of
https://github.com/cobalt-org/cobalt.rs
synced 2024-11-15 00:17:29 +00:00
be05d963c7
The `ignore` field in `.cobalt.yml` is changing from a list of glob patterns to a list `gitignore` patterns, allowing whitelisting and more advanced whitelisting/blacklisting with well defined semantics. Previuously, Cobalt processed all files except `.dot` and `_hidden`, *dest* files/directories. Considerations when designing this: - User workflow: users need `.dot` asset files, like `.htaccess`, copied over. - Implementation: Finding files for pages and posts is coupled together which will be a problem as we refactor them into more general collections or sections. - Performance: Eventually we'll want to implement incremental rebuild (see issue #81) and to do so we'll need to know what collection a file notification is relevant to. `gitignore` patterns were selected for the first item to ensure we had well defined semantics for how blacklist and whitelist features would interact, directory vs file patterns, etc. The last two are the motivation for factoring out file detection. A couple downsides, for now - `cobalt watch` will now rebuild when hidden files are touched. This is unfortunate but seems like an acceptable short term sacrifice until we have a better to expose what files cobal reads. - Handling of overlapping source/dest is a bit ugly. In the future, we should just make these cases error - Handling of hidden post folders is ugly. In the future, we should generalize the concept of pages and posts into collections/sections at which point we'll walk each collection type independently. This will make the non-hidden posts folders the ugly case. We should consider requiring them to be hidden. - There is a known bug where we enable all hidden folders that match the posts folders name rather than only some. Fixes #221 by allowing the user to whitelist `.dot` and `_hidden` files. See the added unit tests for examples. BREAKING CHANGE: The format of `.cobalt.yml`'s `ignore` field has changed from a list of glob patterns to gitignore patterns. |
||
---|---|---|
.. | ||
.child | ||
_child | ||
child | ||
.child.txt | ||
_child.txt | ||
child.txt |