promote most internals of Helium's include directive to public API in laika.theme.* #621
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously the
@:includeJS
and@:includeCSS
directives were only available within the Helium theme, since they cannot be configured via HOCON like most other directives which come bundled withlaika.core
(some of the API allows to pass a function argument which cannot be encoded in HOCON).For this reason authors of alternative themes or end users not using Helium had to either hard-code the includes into their custom templates or re-build or copy a lot of the implementation details.
Since the directives themselves cannot be promoted to become core directives for the reasons stated above, this PR simply aims to remove about 90% of the boilerplate required to re-create them outside of Helium by promoting their builder APIs from an internal Helium package to the public
laika.theme.config
package.Example for creating an instance of a
@:includeCSS
directive that includes all CSS documents in thestyles
directory:This instance can then be registered like any other directive:
After this step the
@:includeCSS
directive can be used in any template outside of Helium.There are no new tests since Helium now delegate to the promoted API, meaning the directive is tested within the Helium suites.
Proper documentation will be added to the manual as part of #576.
FYI @noelwelsh