{"size": 1086, "ext": "js", "max_stars_repo_path": "node_modules/grunt-sass/tasks/sass.js", "max_stars_repo_name": "paulpod/protopod", "max_stars_repo_stars_event_min_datetime": "2016-05-04T14:30:14.000Z", "max_stars_repo_stars_event_max_datetime": "2017-01-12T06:55:06.000Z", "max_issues_repo_path": "node_modules/grunt-sass/tasks/sass.js", "max_issues_repo_name": "paulpod/protopod", "max_issues_repo_issues_event_min_datetime": "2019-06-09T14:29:11.000Z", "max_issues_repo_issues_event_max_datetime": "2019-06-18T20:25:46.000Z", "max_forks_repo_path": "node_modules/grunt-sass/tasks/sass.js", "max_forks_repo_name": "paulpod/protopod", "max_forks_repo_forks_event_min_datetime": "2021-04-10T22:24:08.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-10T22:24:08.000Z"}
{"max_stars_count": 2, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 23.6086956522, "max_line_length": 78, "alphanum_fraction": 0.5985267035}
'use strict';
var path = require('path');
var async = require('async');
var chalk = require('chalk');
var sass = require('node-sass');

module.exports = function (grunt) {
	grunt.registerMultiTask('sass', 'Compile SCSS to CSS', function () {
		var options = this.options({
			includePaths: [],
			outputStyle: 'nested',
			sourceComments: 'none'
		});

		async.eachSeries(this.files, function (el, next) {
			var src = el.src[0];

			if (path.basename(src)[0] === '_') {
				return next();
			}

			sass.render({
				file: src,
				success: function (css, map) {
					grunt.file.write(el.dest, css);
					grunt.log.writeln('File ' + chalk.cyan(el.dest) + ' created.');

					if (map) {
						grunt.file.write(el.dest + '.map', map)
						grunt.log.writeln('File ' + chalk.cyan(el.dest + '.map') + ' created.');
					}

					next();
				},
				error: function (err) {
					grunt.warn(err);
				},
				includePaths: options.includePaths,
				outputStyle: options.outputStyle,
				sourceComments: options.sourceComments,
				sourceMap: options.sourceMap
			});
		}, this.async());
	});
};
