title: Styling a specific set of input types in a reusable way with Sass
body: <p>I'd like to have a mixin function that returns a list of the HTML5 input types. I'd like to manage this in one place, and as new types come up, change the function, not all the places elsewhere in the code. </p>
  
  <p>The problem seems to be that mixins were not designed to return strings that can be used outside of the curly braces in CSS. Here is an example of my mixin (currently returning errors) and how I'd use it: </p>
  
  <pre><code>/* 
   * Set all the up-and-coming input text types here for easier reference 
   * Does not include types that are not meant to be displayed full width, such as: 
          type=number, type=range, type=date, type=color
   */
  @mixin input_text_types( $focus:false ) {
      @if $focus {
          @return #{input[type=text]:focus, input[type=password]:focus, input[type=search]:focus, input[type=email]:focus, input[type=url]:focus, input[type=tel]:focus};
      } @else {
          @return #{input[type=text], input[type=password], input[type=search], input[type=email], input[type=url], input[type=tel]};
      }
  }
  </code></pre>
  
  <p>In use: </p>
  
  <pre><code>@include input_text_types() {
      width: 80%; 
  }
  </code></pre>
  
  <p>The errors I get are like <code>error sass/style.scss (Line 134 of sass/_functions.scss: Invalid CSS after "...@return #{input": expected "}", was "[type=text]:foc...")</code></p>
  
  <p>I've tried to format the output with and without the <code>@return</code> directive, and with different ways I have seen to enclose string values (in quotes, in single quote, in the curly braces with the hash). Anyone ever try to do something like this before? </p>