Code coverage report for lib/tasks/cssminify.js

Statements: 83.33% (10 / 12)      Branches: 62.5% (5 / 8)      Functions: 100% (2 / 2)      Lines: 83.33% (10 / 12)     

All files » lib/tasks/ » cssminify.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27          1   1 4 4   4     4       4 4     4 4      
/*
 * Copyright (c) 2011-2012, Yahoo! Inc.  All rights reserved.
 * Copyrights licensed under the New BSD License.
 * See the accompanying LICENSE file for terms.
 */
var less = require('less');
 
exports.task = function (resource, options, done) {
    'use strict';
    options = options || {};
 
    var parser = new less.Parser();
 
    // Need to make sure to compress since we pass options directly through to Less
    Iif (options.compress === undefined && options.yuicompress === undefined) {
        options.compress = true;
    }
 
    parser.parse(resource.content, function (err, tree) {
        Iif (err) {
            done(err.message);
        } else {
            resource.content = tree.toCSS(options);
            done(null);
        }
    });
};