Skip to content

Commit

Permalink
Prevent !default flag to be printed by default
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnCuppens committed Apr 4, 2020
1 parent b6b6c51 commit 9417b75
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion site/layouts/shortcodes/scss-docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

Prints everything between `// scss-docs start "name"` and `// scss-docs end "name"`
comments in the docs.

Optional parameters:
strip-default: Remove the ` !default` flag from variable assignments - default: `true`
*/ -}}

{{- $name := .Get "name" -}}
Expand All @@ -16,10 +19,14 @@
{{- $match := findRE $regex $css 1 -}}

{{- if (eq (len $match) 0) -}}
{{- errorf "Got no matches for %q in %q! (called in %q)" $name $file $.Page.Path -}}
{{- errorf "Got no matches for %q in %q! (called in %q)" $name $file $.Page.Path -}}
{{- end -}}

{{- $remove_start := replace (index $match 0) $start "" -}}
{{- $result := replace $remove_start $end "" -}}

{{- if ne (.Get "strip-default" | default true) "false" -}}
{{- $result = replace $result " !default" "" -}}
{{- end -}}

{{- highlight $result "scss" "" -}}

0 comments on commit 9417b75

Please sign in to comment.