![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/magento2-base/dev/tools/grunt/tasks/ |
/** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ module.exports = function (grunt) { 'use strict'; var compressor = require('node-minify'), _ = require('underscore'); /** * Helper function used to create config object for compressor. * * @param {Object} options - Options object for a current task. * @param {Object} file - File object with 'sorce' and 'destination' properties. * @return {Object} Config object for compressor. */ function getConfig(options, file) { return _.extend({ input: file.src, output: file.dest }, options); } grunt.registerMultiTask('mage-minify', 'Minify files with a various compressor engines', function () { var done = this.async(), files = this.files, total = files.length, options = this.options(); this.files.forEach(function (file, i) { var config = getConfig(options, file); /** * Callback function. */ config.callback = function (err) { if (err) { console.log(err); done(false); } else if (i === total - 1) { done(); } }; compressor.minify(config); }); }); };