title: Sass-like functions in PostCSS
body: <p>I'm trying out PostCss and trying to find comparable features to Sass. The one feature I'm stuck on is Sass-like functions. </p>
  
  <p>Here's my function is Sass:</p>
  
  <pre><code>// Variables.scss
  $columns: 12; // Grid columns
  $max-width: 1200px; // Grid max width
  
  // Function.scss
  @function grid($cols,$to-px:false) {
    @if ($to-px == false) { @return ($cols / $columns) * 100% };
    @return round(($max-width / $columns) * $cols);
  }
  
  // style.scss
  .class {
    width: grid(3);
  }
  .class2 {
    width: grid(3,true);
  }
  
  // outputs to:
  
  // style.css
  .class {
    width: 25%;
  }
  .class2 {
    width: 300px;
  }
  </code></pre>
  
  <p>In PostCSS can I write a function like this that returns a single CSS value? </p>