sass-site/source/documentation/Sass/Features.html
2018-10-22 14:13:05 -07:00

387 lines
10 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Module: Sass::Features
&mdash; Documentation by YARD 0.9.12
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="../../assets/css/docs.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '../';
framesUrl = "../frames.html#!Sass/Features.html";
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div id="header">
<div id="menu">
<a href="../_index.html">Index (F)</a> &raquo;
<span class='title'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span>
&raquo;
<span class="title">Features</span>
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
Class List
</a>
<a class="full_list_link" id="method_list_link"
href="../method_list.html">
Method List
</a>
<a class="full_list_link" id="file_list_link"
href="../file_list.html">
File List
</a>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Module: Sass::Features
</h1>
<dl class="box">
<dt class="r1">Included in:</dt>
<dd class="r1"><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">.ruby-sass/lib/sass/features.rb</dd>
</dl>
<div class="clear"></div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Provides `Sass.has_feature?` which allows for simple feature detection by
providing a feature name.</p>
</div>
</div>
<div class="tags">
</div>
<h2>Constant Summary</h2>
<dl class="constants">
<dt id="KNOWN_FEATURES-constant" class="">KNOWN_FEATURES =
<div class="docstring">
<div class="discussion">
<p>This is the set of features that can be detected.</p>
<p>When this is updated, the documentation of `feature-exists()` should be
updated as well.</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='const'>Set</span><span class='lbracket'>[</span><span class='op'>*</span><span class='qwords_beg'>%w(</span><span class='words_sep'>
</span><span class='tstring_content'>global-variable-shadowing</span><span class='words_sep'>
</span><span class='tstring_content'>extend-selector-pseudoclass</span><span class='words_sep'>
</span><span class='tstring_content'>units-level-3</span><span class='words_sep'>
</span><span class='tstring_content'>at-error</span><span class='words_sep'>
</span><span class='tstring_content'>custom-property</span><span class='words_sep'>
</span><span class='tstring_end'>)</span></span><span class='rbracket'>]</span></pre></dd>
</dl>
<h2>
Instance Method Summary
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#add_feature-instance_method" title="#add_feature (instance method)">#<strong>add_feature</strong>(feature_name) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Add a feature to Sass.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#has_feature%3F-instance_method" title="#has_feature? (instance method)">#<strong>has_feature?</strong>(feature_name) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Check if a feature exists by name.</p>
</div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="add_feature-instance_method">
#<strong>add_feature</strong>(feature_name) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Add a feature to Sass. Plugins can use this to easily expose their
availability to end users. Plugins must prefix their feature names with a
dash to distinguish them from official features.</p>
</div>
</div>
<div class="tags">
<div class="examples">
<p class="tag_title">Examples:</p>
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span><span class='period'>.</span><span class='id identifier rubyid_add_feature'>add_feature</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-import-globbing</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='const'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span><span class='period'>.</span><span class='id identifier rubyid_add_feature'>add_feature</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-math-cos</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>feature_name</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The case sensitive name of the feature to to add to Sass. Must begin with a
dash.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
39
40
41
42
43
44</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/features.rb', line 39</span>
<span class='kw'>def</span> <span class='id identifier rubyid_add_feature'>add_feature</span><span class='lparen'>(</span><span class='id identifier rubyid_feature_name'>feature_name</span><span class='rparen'>)</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_feature_name'>feature_name</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='CHAR'>?-</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Plugin feature names must begin with a dash</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='const'><span class='object_link'><a href="#KNOWN_FEATURES-constant" title="Sass::Features::KNOWN_FEATURES (constant)">KNOWN_FEATURES</a></span></span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_feature_name'>feature_name</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="has_feature?-instance_method">
#<strong>has_feature?</strong>(feature_name) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Check if a feature exists by name. This is used to implement the Sass
function `feature-exists($feature)`</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>feature_name</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The case sensitive name of the feature to check if it exists in this
version of Sass.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
&mdash;
<div class='inline'>
<p>whether the feature of that name exists.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
24
25
26</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/features.rb', line 24</span>
<span class='kw'>def</span> <span class='id identifier rubyid_has_feature?'>has_feature?</span><span class='lparen'>(</span><span class='id identifier rubyid_feature_name'>feature_name</span><span class='rparen'>)</span>
<span class='const'><span class='object_link'><a href="#KNOWN_FEATURES-constant" title="Sass::Features::KNOWN_FEATURES (constant)">KNOWN_FEATURES</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_feature_name'>feature_name</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Oct 22 13:20:48 2018 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.12 (ruby-2.5.3).
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-535380-14', 'sass-lang.com');
ga('send', 'pageview');
</script>
</body>
</html>