forked from sass/sass-site
-
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.
Merge pull request sass#54 from oddbird/builtin-modules
Port Built-in Modules docs
- Loading branch information
Showing
54 changed files
with
3,843 additions
and
30 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
59 changes: 59 additions & 0 deletions
59
source/_includes/code_snippets/example-first-class-function.liquid
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{% comment -%} | ||
TODO(nweiz): auto-generate this CSS once we're compiling with Dart Sass | ||
{%- endcomment -%} | ||
{% codeExample 'first-class-function' %} | ||
@use "sass:list"; | ||
@use "sass:meta"; | ||
@use "sass:string"; | ||
|
||
/// Return a copy of $list with all elements for which $condition returns `true` | ||
/// removed. | ||
@function remove-where($list, $condition) { | ||
$new-list: (); | ||
$separator: list.separator($list); | ||
@each $element in $list { | ||
@if not meta.call($condition, $element) { | ||
$new-list: list.append($new-list, $element, $separator: $separator); | ||
} | ||
} | ||
@return $new-list; | ||
} | ||
|
||
$fonts: Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
|
||
content { | ||
@function contains-helvetica($string) { | ||
@return string.index($string, "Helvetica"); | ||
} | ||
font-family: remove-where($fonts, meta.get-function("contains-helvetica")); | ||
} | ||
=== | ||
@use "sass:list" | ||
@use "sass:meta" | ||
@use "sass:string" | ||
|
||
/// Return a copy of $list with all elements for which $condition returns `true` | ||
/// removed. | ||
@function remove-where($list, $condition) | ||
$new-list: () | ||
$separator: list.separator($list) | ||
@each $element in $list | ||
@if not meta.call($condition, $element) | ||
$new-list: list.append($new-list, $element, $separator: $separator) | ||
|
||
|
||
@return $new-list | ||
|
||
|
||
$fonts: Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif | ||
|
||
.content | ||
@function contains-helvetica($string) | ||
@return string.index($string, "Helvetica") | ||
|
||
font-family: remove-where($fonts, meta.get-function("contains-helvetica")) | ||
=== | ||
.content { | ||
font-family: Tahoma, Geneva, Arial, sans-serif; | ||
} | ||
{% endcodeExample %} |
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% codeExample 'example-list-index', false %} | ||
@debug list.index(1px solid red, 1px); // 1 | ||
@debug list.index(1px solid red, solid); // 2 | ||
@debug list.index(1px solid red, dashed); // null | ||
=== | ||
@debug list.index(1px solid red, 1px) // 1 | ||
@debug list.index(1px solid red, solid) // 2 | ||
@debug list.index(1px solid red, dashed) // null | ||
{% endcodeExample %} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% codeExample 'example-list-nth', false %} | ||
@debug list.nth(10px 12px 16px, 2); // 12px | ||
@debug list.nth([line1, line2, line3], -1); // line3 | ||
=== | ||
@debug list.nth(10px 12px 16px, 2) // 12px | ||
@debug list.nth([line1, line2, line3], -1) // line3 | ||
{% endcodeExample %} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% codeExample 'map-get', false %} | ||
$font-weights: ("regular": 400, "medium": 500, "bold": 700); | ||
|
||
@debug map.get($font-weights, "medium"); // 500 | ||
@debug map.get($font-weights, "extra-bold"); // null | ||
=== | ||
$font-weights: ("regular": 400, "medium": 500, "bold": 700) | ||
|
||
@debug map.get($font-weights, "medium") // 500 | ||
@debug map.get($font-weights, "extra-bold") // null | ||
{% endcodeExample %} |
2 changes: 1 addition & 1 deletion
2
...-mixin-arbitrary-keyword-arguments.liquid → ...-mixin-arbitrary-keyword-arguments.liquid
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% compatibility 'dart: "1.23.0"', 'libsass: false', 'ruby: false' %} | ||
Only Dart Sass currently supports loading built-in modules with `@use`. Users | ||
of other implementations must call functions using their global names instead. | ||
{% endcompatibility %} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% compatibility 'dart: true', 'libsass: "3.5.0"', 'ruby: "3.5.0"', 'feature: "Argument Type"' %} | ||
In older versions of LibSass and Ruby Sass, the [`call()` function][] took a | ||
string representing a function's name. This was changed to take a function | ||
value instead in preparation for a new module system where functions are no | ||
longer global and so a given name may not always refer to the same function. | ||
|
||
[`call()` function]: /documentation/modules/meta#call | ||
|
||
Passing a string to `call()` still works in all implementations, but it's | ||
deprecated and will be disallowed in future versions. | ||
{% endcompatibility %} |
3 changes: 3 additions & 0 deletions
3
source/_includes/doc_snippets/module-system-function-status.liquid
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% compatibility 'dart: "1.23.0"', 'libsass: false', 'ruby: false' %} | ||
Only Dart Sass currently supports this function. | ||
{% endcompatibility %} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% for name in names offset: 1 %}<div id="{{ name }}">{% endfor -%} | ||
<div class="sl-c-callout sl-c-callout--function" id="{{ names[0] }}"><pre class="signature language-scss"><a class="anchor" href="#{{ names[0] }}"></a><code class="language-scss">{{ signatures }}{% if returns %} <span class="token comment">//=> {{ returns }}</span>{% endif %}</code></pre> | ||
{{ content }} | ||
</div> | ||
{%- for name in names offset: 1 %}</div>{% endfor %} |
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
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
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
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
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
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
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
Oops, something went wrong.