Commit 8075734
committed
Add extension to middleman-sprockets to get http_prefix in Sass
We want to be able to prefix directory paths with the http_prefix in
Sass, however normally the `asset-path` helper tries to add a file
extension, so this commit adds a small extension that skips the usual
logic if the path ends with `/`.
The extension works by reaching into the `Sprockets::Envionment` instance
in the `middleman-sprockets` extension [1], and replacing the definition
of the method `asset_path` [2]. Sprockets turns any calls to
`asset-path` in any CSS/Sass it processes into a call to this method, so
this is our way to smuggle information into our Sass.
[1]: https://github.com/middleman/middleman-sprockets/blob/a32cbe3c8ca129b608bdc852c7ff7ad489f9a087/lib/middleman-sprockets/extension.rb#L28
[2]: https://github.com/middleman/middleman-sprockets/blob/a32cbe3c8ca129b608bdc852c7ff7ad489f9a087/lib/middleman-sprockets/extension.rb#L581 parent e539c73 commit 8075734
File tree
2 files changed
+23
-0
lines changed- lib
- govuk_tech_docs
2 files changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments