Assets: Support Github pages / http_prefix #197
Merged
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.
Hello 👋
This PR fixes asset URLs for sites built for Github pages using the default URL (like the API catalogue), in which paths are prefixed with the repo name.
Changes
$govuk-assets-pathto be overriden by implementorshttp_prefixsettingContext
For repo-specific Github pages, the site is deployed with the repo name prefixed in the path, e.g.
https://alphagov.github.io/api-catalogue/. We'd like to use Middleman'shttp_prefixoption to account for this path prefix, which will allow us to simplify and automate our build process.Our Middleman config looks like this:
With this PR all asset URLs correctly include the
/api-catalogue/prefix, and we can avoid using Middleman'sactivate :relative_assetsfeature.References
asset_path/image-urlhelpers!defaultto allow overrideshttp_prefixconfigued