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

1185 lines
51 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>
Class: Sass::Plugin::Compiler
&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/Plugin/Compiler.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 (C)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Plugin.html" title="Sass::Plugin (module)">Plugin</a></span></span>
&raquo;
<span class="title">Compiler</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>Class: Sass::Plugin::Compiler
</h1>
<dl class="box">
<dt class="r1">Inherits:</dt>
<dd class="r1">
<span class="inheritName">Object</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">Sass::Plugin::Compiler</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
<dt class="r2">Extended by:</dt>
<dd class="r2"><span class='object_link'><a href="../Callbacks.html" title="Sass::Callbacks (module)">Callbacks</a></span></dd>
<dt class="r1">Includes:</dt>
<dd class="r1"><span class='object_link'><a href="Configuration.html" title="Sass::Plugin::Configuration (module)">Configuration</a></span></dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">.ruby-sass/lib/sass/plugin/compiler.rb</dd>
</dl>
<div class="clear"></div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>The Compiler class handles compilation of multiple files and/or
directories, including checking which CSS files are out-of-date and need to
be updated and calling Sass to perform the compilation on those files.</p>
<p><span class='object_link'><a href="../Plugin.html" title="Sass::Plugin (module)">Sass::Plugin</a></span> uses this class to update stylesheets for a single
application. Unlike <span class='object_link'><a href="../Plugin.html" title="Sass::Plugin (module)">Sass::Plugin</a></span>, though, the Compiler class has no
global state, and so multiple instances may be created and used
independently.</p>
<p>If you need to compile a Sass string into CSS, please see the
<span class='object_link'><a href="../Engine.html" title="Sass::Engine (class)">Engine</a></span> class.</p>
<p>Unlike <span class='object_link'><a href="../Plugin.html" title="Sass::Plugin (module)">Sass::Plugin</a></span>, this class doesn&#39;t keep track of whether or how
many times a stylesheet should be updated. Therefore, the following
`Sass::Plugin` options are ignored by the Compiler:</p>
<ul><li>
<p>`:never_update`</p>
</li><li>
<p>`:always_check`</p>
</li></ul>
</div>
</div>
<div class="tags">
</div>
<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="#clean-instance_method" title="#clean (instance method)">#<strong>clean</strong>(individual_files = []) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Remove all output files that would be created by calling
update_stylesheets, if they exist.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#engine_options-instance_method" title="#engine_options (instance method)">#<strong>engine_options</strong>(additional_options = {}) &#x21d2; {Symbol =&gt; Object} </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Non-destructively modifies <span class='object_link'><a href="Configuration.html#options-instance_method" title="Sass::Plugin::Configuration#options (method)">Sass::Plugin::Configuration#options</a></span> so that default values are properly
set, and returns the result.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#file_list-instance_method" title="#file_list (instance method)">#<strong>file_list</strong>(individual_files = []) &#x21d2; Array&lt;(String, String, String)&gt; </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Construct a list of files that might need to be compiled from the provided
individual_files and the template_locations.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(opts = {}) &#x21d2; Compiler </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>Creates a new compiler.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#stylesheet_needs_update%3F-instance_method" title="#stylesheet_needs_update? (instance method)">#<strong>stylesheet_needs_update?</strong>(css_file, template_file) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Compass expects this to exist.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#update_stylesheets-instance_method" title="#update_stylesheets (instance method)">#<strong>update_stylesheets</strong>(individual_files = []) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Updates out-of-date stylesheets.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#watch-instance_method" title="#watch (instance method)">#<strong>watch</strong>(individual_files = [], options = {}) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Watches the template directory (or directories) and updates the CSS files
whenever the related Sass/SCSS files change.</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Callbacks.html" title="Sass::Callbacks (module)">Callbacks</a></span></h3>
<p class="inherited"><span class='object_link'><a href="../Callbacks.html#extended-class_method" title="Sass::Callbacks.extended (method)">extended</a></span></p>
<h3 class="inherited">Methods included from <span class='object_link'><a href="Configuration.html" title="Sass::Plugin::Configuration (module)">Configuration</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Configuration.html#add_template_location-instance_method" title="Sass::Plugin::Configuration#add_template_location (method)">#add_template_location</a></span>, <span class='object_link'><a href="Configuration.html#default_options-instance_method" title="Sass::Plugin::Configuration#default_options (method)">#default_options</a></span>, <span class='object_link'><a href="Configuration.html#options-instance_method" title="Sass::Plugin::Configuration#options (method)">#options</a></span>, <span class='object_link'><a href="Configuration.html#remove_template_location-instance_method" title="Sass::Plugin::Configuration#remove_template_location (method)">#remove_template_location</a></span>, <span class='object_link'><a href="Configuration.html#reset!-instance_method" title="Sass::Plugin::Configuration#reset! (method)">#reset!</a></span>, <span class='object_link'><a href="Configuration.html#template_location_array-instance_method" title="Sass::Plugin::Configuration#template_location_array (method)">#template_location_array</a></span></p>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(opts = {}) &#x21d2; <tt><span class='object_link'><a href="" title="Sass::Plugin::Compiler (class)">Compiler</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Creates a new compiler.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>opts</span>
<span class='type'>(<tt>{Symbol =&gt; Object}</tt>)</span>
<em class="default">(defaults to: <tt>{}</tt>)</em>
&mdash;
<div class='inline'>
<p>See <a href="../../file.SASS_REFERENCE.html#Options" title="the Sass options documentation">the Sass options documentation</a>.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
35
36
37
38</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/compiler.rb', line 35</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='ivar'>@watched_files</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(opts = {}) &#x21d2; <tt><span class='object_link'><a href="" title="Sass::Plugin::Compiler (class)">Compiler</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Creates a new compiler.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>opts</span>
<span class='type'>(<tt>{Symbol =&gt; Object}</tt>)</span>
<em class="default">(defaults to: <tt>{}</tt>)</em>
&mdash;
<div class='inline'>
<p>See <a href="../../file.SASS_REFERENCE.html#Options" title="the Sass options documentation">the Sass options documentation</a>.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
35
36
37
38</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/compiler.rb', line 35</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='ivar'>@watched_files</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="clean-instance_method">
#<strong>clean</strong>(individual_files = []) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Remove all output files that would be created by calling
update_stylesheets, if they exist.</p>
<p>This method runs the deleting_css and deleting_sourcemap callbacks for the
files that are deleted.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>individual_files</span>
<span class='type'>(<tt>Array&lt;(String, String[, String])&gt;</tt>)</span>
<em class="default">(defaults to: <tt>[]</tt>)</em>
&mdash;
<div class='inline'>
<p>A list of files to check for updates **in addition to those specified by
the <a href="../../file.SASS_REFERENCE.html#template_location-option" title="`:template_location` option">`:template_location` option</a>.** The first string in each pair is the location of the Sass/SCSS
file, the second is the location of the CSS file that it should be compiled
to. The third string, if provided, is the location of the Sourcemap file.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
362
363
364
365
366
367
368
369
370
371
372
373
374</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/compiler.rb', line 362</span>
<span class='kw'>def</span> <span class='id identifier rubyid_clean'>clean</span><span class='lparen'>(</span><span class='id identifier rubyid_individual_files'>individual_files</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='id identifier rubyid_file_list'>file_list</span><span class='lparen'>(</span><span class='id identifier rubyid_individual_files'>individual_files</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='lparen'>(</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_css_file'>css_file</span><span class='comma'>,</span> <span class='id identifier rubyid_sourcemap_file'>sourcemap_file</span><span class='rparen'>)</span><span class='op'>|</span>
<span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_css_file'>css_file</span><span class='rparen'>)</span>
<span class='id identifier rubyid_run_deleting_css'>run_deleting_css</span> <span class='id identifier rubyid_css_file'>css_file</span>
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_css_file'>css_file</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_sourcemap_file'>sourcemap_file</span> <span class='op'>&amp;&amp;</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_sourcemap_file'>sourcemap_file</span><span class='rparen'>)</span>
<span class='id identifier rubyid_run_deleting_sourcemap'>run_deleting_sourcemap</span> <span class='id identifier rubyid_sourcemap_file'>sourcemap_file</span>
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_sourcemap_file'>sourcemap_file</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="engine_options-instance_method">
#<strong>engine_options</strong>(additional_options = {}) &#x21d2; <tt>{Symbol =&gt; Object}</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Non-destructively modifies <span class='object_link'><a href="Configuration.html#options-instance_method" title="Sass::Plugin::Configuration#options (method)">Sass::Plugin::Configuration#options</a></span> so that default values are properly
set, and returns the result.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>additional_options</span>
<span class='type'>(<tt>{Symbol =&gt; Object}</tt>)</span>
<em class="default">(defaults to: <tt>{}</tt>)</em>
&mdash;
<div class='inline'>
<p>An options hash with which to merge <span class='object_link'><a href="Configuration.html#options-instance_method" title="Sass::Plugin::Configuration#options (method)">Sass::Plugin::Configuration#options</a></span></p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>{Symbol =&gt; Object}</tt>)</span>
&mdash;
<div class='inline'>
<p>The modified options hash</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
337
338
339
340
341
342
343</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/compiler.rb', line 337</span>
<span class='kw'>def</span> <span class='id identifier rubyid_engine_options'>engine_options</span><span class='lparen'>(</span><span class='id identifier rubyid_additional_options'>additional_options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_additional_options'>additional_options</span><span class='rparen'>)</span>
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:load_paths</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_load_paths'>load_paths</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:sourcemap</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='symbol'>:auto</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:sourcemap</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='kw'>true</span>
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:sourcemap</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='symbol'>:none</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:sourcemap</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='kw'>false</span>
<span class='id identifier rubyid_opts'>opts</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="file_list-instance_method">
#<strong>file_list</strong>(individual_files = []) &#x21d2; <tt>Array&lt;(String, String, String)&gt;</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Construct a list of files that might need to be compiled from the provided
individual_files and the template_locations.</p>
<p>Note: this method does not cache the results as they can change across
invocations when sass files are added or removed.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>individual_files</span>
<span class='type'>(<tt>Array&lt;(String, String[, String])&gt;</tt>)</span>
<em class="default">(defaults to: <tt>[]</tt>)</em>
&mdash;
<div class='inline'>
<p>A list of files to check for updates **in addition to those specified by
the <a href="../../file.SASS_REFERENCE.html#template_location-option" title="`:template_location` option">`:template_location` option</a>.** The first string in each pair is the location of the Sass/SCSS
file, the second is the location of the CSS file that it should be compiled
to. The third string, if provided, is the location of the Sourcemap file.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array&lt;(String, String, String)&gt;</tt>)</span>
&mdash;
<div class='inline'>
<p>A list of [sass_file, css_file, sourcemap_file] tuples similar to what was
passed in, but expanded to include the current state of the directories
being updated.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/compiler.rb', line 240</span>
<span class='kw'>def</span> <span class='id identifier rubyid_file_list'>file_list</span><span class='lparen'>(</span><span class='id identifier rubyid_individual_files'>individual_files</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='id identifier rubyid_files'>files</span> <span class='op'>=</span> <span class='id identifier rubyid_individual_files'>individual_files</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_tuple'>tuple</span><span class='op'>|</span>
<span class='kw'>if</span> <span class='id identifier rubyid_engine_options'>engine_options</span><span class='lbracket'>[</span><span class='symbol'>:sourcemap</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:none</span>
<span class='id identifier rubyid_tuple'>tuple</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='int'>1</span><span class='rbracket'>]</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_tuple'>tuple</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>&lt;</span> <span class='int'>3</span>
<span class='lbracket'>[</span><span class='id identifier rubyid_tuple'>tuple</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_tuple'>tuple</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_sourcemap_name'><span class='object_link'><a href="../Util.html#sourcemap_name-instance_method" title="Sass::Util#sourcemap_name (method)">sourcemap_name</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tuple'>tuple</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbracket'>]</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_tuple'>tuple</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_template_location_array'>template_location_array</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_template_location'>template_location</span><span class='comma'>,</span> <span class='id identifier rubyid_css_location'>css_location</span><span class='op'>|</span>
<span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_glob'><span class='object_link'><a href="../Util.html#glob-instance_method" title="Sass::Util#glob (method)">glob</a></span></span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_template_location'>template_location</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>**</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[^_]*.s[ca]ss</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_file'>file</span><span class='op'>|</span>
<span class='comment'># Get the relative path to the file
</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_relative_path_from'><span class='object_link'><a href="../Util.html#relative_path_from-instance_method" title="Sass::Util#relative_path_from (method)">relative_path_from</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_template_location'>template_location</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
<span class='id identifier rubyid_css'>css</span> <span class='op'>=</span> <span class='id identifier rubyid_css_filename'>css_filename</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_css_location'>css_location</span><span class='rparen'>)</span>
<span class='id identifier rubyid_sourcemap'>sourcemap</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_sourcemap_name'><span class='object_link'><a href="../Util.html#sourcemap_name-instance_method" title="Sass::Util#sourcemap_name (method)">sourcemap_name</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_css'>css</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_engine_options'>engine_options</span><span class='lbracket'>[</span><span class='symbol'>:sourcemap</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:none</span>
<span class='id identifier rubyid_files'>files</span> <span class='op'>&lt;&lt;</span> <span class='lbracket'>[</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_css'>css</span><span class='comma'>,</span> <span class='id identifier rubyid_sourcemap'>sourcemap</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_files'>files</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="stylesheet_needs_update?-instance_method">
#<strong>stylesheet_needs_update?</strong>(css_file, template_file) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Compass expects this to exist</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
346
347
348</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/compiler.rb', line 346</span>
<span class='kw'>def</span> <span class='id identifier rubyid_stylesheet_needs_update?'>stylesheet_needs_update?</span><span class='lparen'>(</span><span class='id identifier rubyid_css_file'>css_file</span><span class='comma'>,</span> <span class='id identifier rubyid_template_file'>template_file</span><span class='rparen'>)</span>
<span class='const'><span class='object_link'><a href="StalenessChecker.html" title="Sass::Plugin::StalenessChecker (class)">StalenessChecker</a></span></span><span class='period'>.</span><span class='id identifier rubyid_stylesheet_needs_update?'><span class='object_link'><a href="StalenessChecker.html#stylesheet_needs_update%3F-class_method" title="Sass::Plugin::StalenessChecker.stylesheet_needs_update? (method)">stylesheet_needs_update?</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_css_file'>css_file</span><span class='comma'>,</span> <span class='id identifier rubyid_template_file'>template_file</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="update_stylesheets-instance_method">
#<strong>update_stylesheets</strong>(individual_files = []) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Updates out-of-date stylesheets.</p>
<p>Checks each Sass/SCSS file in
<a href="../../file.SASS_REFERENCE.html#template_location-option" title="`:template_location`">`:template_location`</a> to
see if it&#39;s been modified more recently than the corresponding CSS file
in <a href="../../file.SASS_REFERENCE.html#css_location-option" title="`:css_location`">`:css_location`</a>. If it has,
it updates the CSS file.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>individual_files</span>
<span class='type'>(<tt>Array&lt;(String, String[, String])&gt;</tt>)</span>
<em class="default">(defaults to: <tt>[]</tt>)</em>
&mdash;
<div class='inline'>
<p>A list of files to check for updates **in addition to those specified by
the <a href="../../file.SASS_REFERENCE.html#template_location-option" title="`:template_location` option">`:template_location` option</a>.** The first string in each pair is the location of the Sass/SCSS
file, the second is the location of the CSS file that it should be compiled
to. The third string, if provided, is the location of the Sourcemap file.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/compiler.rb', line 201</span>
<span class='kw'>def</span> <span class='id identifier rubyid_update_stylesheets'>update_stylesheets</span><span class='lparen'>(</span><span class='id identifier rubyid_individual_files'>individual_files</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</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='op'>::</span><span class='const'><span class='object_link'><a href="../Plugin.html" title="Sass::Plugin (module)">Plugin</a></span></span><span class='period'>.</span><span class='id identifier rubyid_checked_for_updates'><span class='object_link'><a href="../Plugin.html#checked_for_updates-instance_method" title="Sass::Plugin#checked_for_updates (method)">checked_for_updates</a></span></span> <span class='op'>=</span> <span class='kw'>true</span>
<span class='id identifier rubyid_staleness_checker'>staleness_checker</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="StalenessChecker.html" title="Sass::Plugin::StalenessChecker (class)">StalenessChecker</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="StalenessChecker.html#initialize-instance_method" title="Sass::Plugin::StalenessChecker#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_engine_options'>engine_options</span><span class='rparen'>)</span>
<span class='id identifier rubyid_files'>files</span> <span class='op'>=</span> <span class='id identifier rubyid_file_list'>file_list</span><span class='lparen'>(</span><span class='id identifier rubyid_individual_files'>individual_files</span><span class='rparen'>)</span>
<span class='id identifier rubyid_run_updating_stylesheets'>run_updating_stylesheets</span><span class='lparen'>(</span><span class='id identifier rubyid_files'>files</span><span class='rparen'>)</span>
<span class='id identifier rubyid_updated_stylesheets'>updated_stylesheets</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_files'>files</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_css'>css</span><span class='comma'>,</span> <span class='id identifier rubyid_sourcemap'>sourcemap</span><span class='op'>|</span>
<span class='comment'># TODO: Does staleness_checker need to check the sourcemap file as well?
</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:always_update</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_staleness_checker'>staleness_checker</span><span class='period'>.</span><span class='id identifier rubyid_stylesheet_needs_update?'>stylesheet_needs_update?</span><span class='lparen'>(</span><span class='id identifier rubyid_css'>css</span><span class='comma'>,</span> <span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
<span class='comment'># XXX For consistency, this should return the sourcemap too, but it would
</span> <span class='comment'># XXX be an API change.
</span> <span class='id identifier rubyid_updated_stylesheets'>updated_stylesheets</span> <span class='op'>&lt;&lt;</span> <span class='lbracket'>[</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_css'>css</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_update_stylesheet'>update_stylesheet</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_css'>css</span><span class='comma'>,</span> <span class='id identifier rubyid_sourcemap'>sourcemap</span><span class='rparen'>)</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_run_not_updating_stylesheet'>run_not_updating_stylesheet</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_css'>css</span><span class='comma'>,</span> <span class='id identifier rubyid_sourcemap'>sourcemap</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_run_updated_stylesheets'>run_updated_stylesheets</span><span class='lparen'>(</span><span class='id identifier rubyid_updated_stylesheets'>updated_stylesheets</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="watch-instance_method">
#<strong>watch</strong>(individual_files = [], options = {}) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Watches the template directory (or directories) and updates the CSS files
whenever the related Sass/SCSS files change. `watch` never returns.</p>
<p>Whenever a change is detected to a Sass/SCSS file in
<a href="../../file.SASS_REFERENCE.html#template_location-option" title="`:template_location`">`:template_location`</a>, the
corresponding CSS file in <a href="../../file.SASS_REFERENCE.html#css_location-option" title="`:css_location`">`:css_location`</a> will be recompiled. The CSS files of any Sass/SCSS files
that import the changed file will also be recompiled.</p>
<p>Before the watching starts in earnest, `watch` calls <span class='object_link'><a href="#update_stylesheets-instance_method" title="Sass::Plugin::Compiler#update_stylesheets (method)">#update_stylesheets</a></span>.</p>
<p>Note that `watch` uses the [Listen](<a
href="http://github.com/guard/listen">github.com/guard/listen</a>) library
to monitor the filesystem for changes. Listen isn&#39;t loaded until
`watch` is run. The version of Listen distributed with Sass is loaded by
default, but if another version has already been loaded that will be used
instead.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>individual_files</span>
<span class='type'>(<tt>Array&lt;(String, String[, String])&gt;</tt>)</span>
<em class="default">(defaults to: <tt>[]</tt>)</em>
&mdash;
<div class='inline'>
<p>A list of files to check for updates **in addition to those specified by
the <a href="../../file.SASS_REFERENCE.html#template_location-option" title="`:template_location` option">`:template_location` option</a>.** The first string in each pair is the location of the Sass/SCSS
file, the second is the location of the CSS file that it should be compiled
to. The third string, if provided, is the location of the Sourcemap file.</p>
</div>
</li>
<li>
<span class='name'>options</span>
<span class='type'>(<tt>Hash</tt>)</span>
<em class="default">(defaults to: <tt>{}</tt>)</em>
&mdash;
<div class='inline'>
<p>The options that control how watching works.</p>
</div>
</li>
</ul>
<p class="tag_title">Options Hash (<tt>options</tt>):</p>
<ul class="option">
<li>
<span class="name">:skip_initial_update</span>
<span class="type">(<tt>Boolean</tt>)</span>
<span class="default">
</span>
&mdash; <div class='inline'>
<p>Don&#39;t do an initial update when starting the watcher when true</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/compiler.rb', line 291</span>
<span class='kw'>def</span> <span class='id identifier rubyid_watch'>watch</span><span class='lparen'>(</span><span class='id identifier rubyid_individual_files'>individual_files</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='ivar'>@inferred_directories</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='id identifier rubyid_individual_files'>individual_files</span> <span class='op'>=</span> <span class='id identifier rubyid_individual_files'>individual_files</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_individual_files'>individual_files</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
<span class='id identifier rubyid_update_stylesheets'>update_stylesheets</span><span class='lparen'>(</span><span class='id identifier rubyid_individual_files'>individual_files</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:skip_initial_update</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_directories'>directories</span> <span class='op'>=</span> <span class='id identifier rubyid_watched_paths'>watched_paths</span>
<span class='id identifier rubyid_individual_files'>individual_files</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='rparen'>)</span><span class='op'>|</span>
<span class='id identifier rubyid_source'>source</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='rparen'>)</span>
<span class='ivar'>@watched_files</span> <span class='op'>&lt;&lt;</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_realpath'><span class='object_link'><a href="../Util.html#realpath-instance_method" title="Sass::Util#realpath (method)">realpath</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
<span class='ivar'>@inferred_directories</span> <span class='op'>&lt;&lt;</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_directories'>directories</span> <span class='op'>+=</span> <span class='ivar'>@inferred_directories</span>
<span class='id identifier rubyid_directories'>directories</span> <span class='op'>=</span> <span class='id identifier rubyid_remove_redundant_directories'>remove_redundant_directories</span><span class='lparen'>(</span><span class='id identifier rubyid_directories'>directories</span><span class='rparen'>)</span>
<span class='comment'># TODO: Keep better track of what depends on what
</span> <span class='comment'># so we don&#39;t have to run a global update every time anything changes.
</span> <span class='comment'># XXX The :additional_watch_paths option exists for Compass to use until
</span> <span class='comment'># a deprecated feature is removed. It may be removed without warning.
</span> <span class='id identifier rubyid_directories'>directories</span> <span class='op'>+=</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:additional_watch_paths</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
<span class='symbol'>:relative_paths</span> <span class='op'>=&gt;</span> <span class='kw'>false</span><span class='comma'>,</span>
<span class='comment'># The native windows listener is much slower than the polling option, according to
</span> <span class='comment'># https://github.com/nex3/sass/commit/a3031856b22bc834a5417dedecb038b7be9b9e3e
</span> <span class='symbol'>:force_polling</span> <span class='op'>=&gt;</span> <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:poll</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_windows?'><span class='object_link'><a href="../Util.html#windows%3F-instance_method" title="Sass::Util#windows? (method)">windows?</a></span></span>
<span class='rbrace'>}</span>
<span class='id identifier rubyid_listener'>listener</span> <span class='op'>=</span> <span class='id identifier rubyid_create_listener'>create_listener</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_directories'>directories</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_modified'>modified</span><span class='comma'>,</span> <span class='id identifier rubyid_added'>added</span><span class='comma'>,</span> <span class='id identifier rubyid_removed'>removed</span><span class='op'>|</span>
<span class='id identifier rubyid_on_file_changed'>on_file_changed</span><span class='lparen'>(</span><span class='id identifier rubyid_individual_files'>individual_files</span><span class='comma'>,</span> <span class='id identifier rubyid_modified'>modified</span><span class='comma'>,</span> <span class='id identifier rubyid_added'>added</span><span class='comma'>,</span> <span class='id identifier rubyid_removed'>removed</span><span class='rparen'>)</span>
<span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_modified'>modified</span><span class='comma'>,</span> <span class='id identifier rubyid_added'>added</span><span class='comma'>,</span> <span class='id identifier rubyid_removed'>removed</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
<span class='kw'>end</span>
<span class='kw'>begin</span>
<span class='id identifier rubyid_listener'>listener</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span>
<span class='id identifier rubyid_sleep'>sleep</span>
<span class='kw'>rescue</span> <span class='const'>Interrupt</span>
<span class='comment'># Squelch Interrupt for clean exit from Listen::Listener
</span> <span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Oct 22 13:20:52 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>