forked from google/docsy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RTL support via a single main style file (google#2093)
- Loading branch information
Showing
5 changed files
with
88 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +0,0 @@ | ||
@each $breakpoint, $_ in $container-max-widths { | ||
@include media-breakpoint-up($breakpoint) { | ||
html[dir="rtl"] .ms-#{$breakpoint}-auto { | ||
margin-left: initial !important; | ||
} | ||
} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,30 @@ | ||
{{ $scssMain := "scss/main.scss" -}} | ||
{{ $css := resources.Get $scssMain | ||
| toCSS (dict "enableSourceMap" (not hugo.IsProduction)) -}} | ||
{{ $bsRtlCss := "vendor/bootstrap/dist/css/bootstrap.rtl.css" -}} | ||
{{ $rtlCSS := "" -}} | ||
|
||
{{/* NOTE: we only apply `postCSS` in production or for RTL languages. This | ||
makes it snappier to develop in Chrome, but it may look sub-optimal in other | ||
browsers. */ -}} | ||
|
||
{{ if eq .Site.Language.LanguageDirection "rtl" -}} | ||
{{ with resources.Get $bsRtlCss -}} | ||
{{ $rtlCSS = . -}} | ||
{{ else -}} | ||
{{ $msg := printf "Resource not found: %s" $bsRtlCss -}} | ||
{{ warnf $msg -}} | ||
<meta name="docsy-info" content="{{ $msg }}"> | ||
{{ end -}} | ||
{{ $css = $css | ||
| postCSS (dict "use" "autoprefixer rtlcss" "noMap" true) | ||
| resources.Copy (replace $scssMain "." ".rtl.") -}} | ||
{{ else if hugo.IsProduction -}} | ||
{{ $css = $css | postCSS -}} | ||
{{ end -}} | ||
|
||
{{ if hugo.IsProduction -}} | ||
{{ with $rtlCSS -}} | ||
{{ $rtlCSS = . | postCSS | minify | fingerprint -}} | ||
{{ end -}} | ||
{{ $css = $css | postCSS | minify | fingerprint -}} | ||
<link rel="preload" href="{{ $css.RelPermalink }}" as="style"> | ||
{{- end -}} | ||
|
||
{{/* NOTE: when not in production, we don't apply `postCSS`. This makes it | ||
snappier to develop in Chrome, but makes it look sub-optimal in other browsers. | ||
*/ -}} | ||
{{ $css = $css | minify | fingerprint -}} | ||
<link rel="preload" href="{{ $css.RelPermalink }}" as="style" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous"> | ||
{{ end -}} | ||
|
||
{{ with $css -}} | ||
<link href="{{ .RelPermalink }}" rel="stylesheet"> | ||
<link href="{{ .RelPermalink }}" rel="stylesheet" | ||
{{- with .Data.Integrity }} integrity="{{ . }}" crossorigin="anonymous"{{ end -}} | ||
> | ||
{{ else -}} | ||
{{ errorf "Resource not found: %s" $scssMain -}} | ||
{{ end -}} | ||
|
||
{{ with $rtlCSS -}} | ||
<link href="{{ $rtlCSS.RelPermalink }}" rel="stylesheet"> | ||
{{ errorf "Resource not found or error building CSS: %s" $scssMain -}} | ||
{{ end -}} | ||
|
||
{{- /**/ -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters