/*
 * grunt-contrib-sass
 * http://gruntjs.com/
 *
 * Copyright (c) 2012 Sindre Sorhus, contributors
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {
  var path = require('path');
  var async = grunt.util.async;

  grunt.registerMultiTask('sass', 'Compile Sass to CSS', function() {
    var helpers = require('grunt-lib-contrib').init(grunt);
    var options = this.options();
    var cb = this.async();
    var args = ['--stdin'].concat(helpers.optsToArgs(options));

    grunt.verbose.writeflags(options, 'Options');

    async.forEachSeries(this.files, function(el, cb2) {
      var elArgs = [el.dest];
      var src = el.src;
      var files = grunt.file.expandFiles(src);
      var max = files.map(function(filepath) {
        return grunt.file.read(filepath);
      }).join('\n');

      if (path.extname(src) === '.scss') {
        elArgs.push('--scss');
      }

      // Make sure grunt creates the destination folders
      grunt.file.write(el.dest, '');

      // Add dirs of specified files to the sass path
      files.forEach(function(el) {
        elArgs.push('--load-path', path.dirname(el));
      });

      var sass = grunt.util.spawn({
        cmd: process.platform === 'win32' ? 'sass.bat' : 'sass',
        args: elArgs.concat(args)
      }, function(error, result, code) {
        if (code === 127) {
          return grunt.warn(
            'You need to have Ruby and Sass installed and in your PATH for ' +
            'this task to work. More info: ' +
            'https://github.com/gruntjs/grunt-contrib-sass'
          );
        }
        cb2(code > 0);
      });

      sass.stdin.write(new Buffer(max));
      sass.stdin.end();
      sass.stdout.pipe(process.stdout);
      sass.stderr.pipe(process.stderr);
    }, function(error) {
      cb(!error);
    });
  });
};

@@ -217,40 +217,8 @@
 h');
-%0A  var async = grunt.util.async;
 %0A%0A  
@@ -418,275 +418,130 @@
 var 
-args = %5B'--stdin'%5D.concat(helpers.optsToArgs(options));%0A%0A    grunt.verbose.writeflags(options, 'Options');%0A%0A    async.forEachSeries(this.files, function(el, cb2) %7B
+src = this.file.src;%0A    var dest = this.file.dest;
 %0A    
-  
 var 
-elA
+a
 rgs = %5B
-el.
 dest
-%5D;%0A      var src = el.src;%0A      var files = grunt.file.expandFiles(src
+, '--stdin'%5D.concat(helpers.optsToArgs(options)
 );%0A
-  
     
@@ -550,21 +550,19 @@
 r max = 
-files
+src
 .map(fun
@@ -575,26 +575,24 @@
 filepath) %7B%0A
-  
       return
@@ -619,18 +619,16 @@
 epath);%0A
-  
     %7D).j
@@ -637,24 +637,73 @@
 n('%5Cn');%0A%0A  
+  grunt.verbose.writeflags(options, 'Options');%0A%0A
     if (path
@@ -714,16 +714,19 @@
 name(src
+%5B0%5D
 ) === '.
@@ -732,37 +732,33 @@
 .scss') %7B%0A      
-  elA
+a
 rgs.push('--scss
@@ -769,15 +769,11 @@
     
-  
 %7D%0A%0A
-  
     
@@ -827,18 +827,16 @@
 ers%0A    
- 
- 
 grunt.fi
@@ -848,11 +848,8 @@
 ite(
-el.
 dest
@@ -852,26 +852,24 @@
 dest, '');%0A%0A
-  
     // Add d
@@ -916,15 +916,11 @@
     
- 
- files
+src
 .for
@@ -949,13 +949,9 @@
     
-  elA
+a
 rgs.
@@ -989,33 +989,29 @@
 e(el));%0A    
- 
- 
 %7D);%0A%0A
-  
     var sass
@@ -1032,18 +1032,16 @@
 spawn(%7B%0A
-  
       cm
@@ -1105,42 +1105,23 @@
     
-  
 args: 
-elArgs.concat(
 args
-)
 %0A    
-  
 %7D, f
@@ -1147,26 +1147,24 @@
 lt, code) %7B%0A
-  
       if (co
@@ -1181,26 +1181,24 @@
 ) %7B%0A        
-  
 return grunt
@@ -1214,18 +1214,16 @@
         
- 
- 
 'You nee
@@ -1291,18 +1291,16 @@
         
-  
 'this ta
@@ -1336,18 +1336,16 @@
         
- 
- 
 'https:/
@@ -1384,18 +1384,16 @@
 b-sass'%0A
-  
         
@@ -1405,22 +1405,18 @@
     
-  %7D%0A  
+%7D%0A
       cb
 2(co
@@ -1415,23 +1415,17 @@
   cb
-2(code %3E 0
+(error
 );%0A
-  
     
@@ -1429,18 +1429,16 @@
    %7D);%0A%0A
-  
     sass
@@ -1468,26 +1468,24 @@
 (max));%0A    
- 
- 
 sass.stdin.e
@@ -1490,18 +1490,16 @@
 .end();%0A
-  
     sass
@@ -1532,18 +1532,16 @@
 t);%0A    
- 
- 
 sass.std
@@ -1570,59 +1570,8 @@
 r);%0A
-    %7D, function(error) %7B%0A      cb(!error);%0A    %7D);%0A
   %7D)

Use this.file instead of deprecated this.files