nanoc / features

Collection of feature requests
2 stars 1 forks source link

Separate helper contexts #11

Closed denisdefreyne closed 6 years ago

denisdefreyne commented 7 years ago

Currently, all files in lib are loaded into the global context, which makes helpers available everywhere, anywhere.

This is fine (does not cause problems), but can be confusing when attempting to use a helper in a situation where it’s not supported. For example, a helper that uses @item can’t be used in the preprocessor or the postprocessor, yet it can still be called (and will cause an error).

Idea: Be able to define where helpers are supported, and make enabling a helper activate it only in contexts where it is usable.

denisdefreyne commented 6 years ago

As of Nanoc 4.7.10, the #use_helper function does this.