Компрессор YUI через PhpStorm Watcher не запутывает код JavaScript - PullRequest
0 голосов
/ 21 ноября 2019

Согласно названию, у меня есть PhpStorm FileWatcher, который запускает YUI Compressor на каждом имеющемся у меня .js.

Я не запускаю компрессор с параметром --nomunge, но файл .min.js произведентолько минимизирован.

Это JS I'm, который не запутывается:

var impCoreProducts = false;
var impSellingAreas = false;

function addImporterCoreProduct() {
    let lastProduct          = impCoreProducts.find('.coreproduct').last();
    let newProduct           = lastProduct.clone();
    let newProductName       = newProduct.find('[name^="pf-imp-coreprod-name"]').first();
    let newProductYearvol    = newProduct.find('input').first();
    let newProductNameVal    = newProductName.attr('name').split('-');
    let newProductYearvolVal = newProductYearvol.attr('name').split('-');
    newProductNameVal[newProductNameVal.length - 1]++;
    newProductYearvolVal[newProductYearvolVal.length - 1]++;
    newProductNameVal    = newProductNameVal.join('-');
    newProductYearvolVal = newProductYearvolVal.join('-');
    newProductName.attr('name', newProductNameVal);
    newProductYearvol.attr('name', newProductYearvolVal);
    lastProduct.after(newProduct);
}

function addImporterSellingArea() {
    let lastSellingArea          = impSellingAreas.find('.sellingarea').last();
    let newSellingArea           = lastSellingArea.clone();
    let newSellingAreaCountry    = newSellingArea.find('[name^="pf-imp-sellarea-country"]').first();
    let newSellingAreaRegion     = newSellingArea.find('[name^="pf-imp-sellarea-region"]').first();
    let newSellingAreaCity       = newSellingArea.find('[name^="pf-imp-sellarea-city"]').first();
    let newSellingAreaCountryVal = newSellingAreaCountry.attr('name').split('-');
    let newSellingAreaRegionVal  = newSellingAreaRegion.attr('name').split('-');
    let newSellingAreaCityVal    = newSellingAreaCity.attr('name').split('-');
    newSellingAreaCountryVal[newSellingAreaCountryVal.length - 1]++;
    newSellingAreaRegionVal[newSellingAreaRegionVal.length - 1]++;
    newSellingAreaCityVal[newSellingAreaCityVal.length - 1]++;
    newSellingAreaCountryVal = newSellingAreaCountryVal.join('-');
    newSellingAreaRegionVal  = newSellingAreaRegionVal.join('-');
    newSellingAreaCityVal    = newSellingAreaCityVal.join('-');
    newSellingAreaCountry.attr('name', newSellingAreaCountryVal);
    newSellingAreaRegion.attr('name', newSellingAreaRegionVal);
    newSellingAreaCity.attr('name', newSellingAreaCityVal);
    lastSellingArea.after(newSellingArea);
}

function attachSellingAreaChainSelect(sellingArea) {
    let countrySelect = sellingArea.find('[data-type="country"]');
    let regionSelect  = sellingArea.find('[data-type="region"]');
    let citySelect    = sellingArea.find('[data-type="city"]');
    countrySelect.on('change', function() {
        // noinspection JSIgnoredPromiseFromCall
        $.ajax({
            cache       : false,
            data        : {
                action : 'getgeoareas',
                from   : 'country',
                val    : $(this).val()
            },
            dataType    : 'json',
            method      : 'post',
            success     : function(data) { console.log(data); },
            url         : '/service.php'
        });
    });
}

$(function() {
    impCoreProducts = $('#importer-coreproducts');
    impCoreProducts.find('.add-button').on('click', function() { addImporterCoreProduct(); });
    impSellingAreas = $('#importer-sellingareas');
    impSellingAreas.find('.add-button').on('click', function() { addImporterSellingArea(); });
    attachSellingAreaChainSelect(impSellingAreas.find('.sellingarea'));
});

А это скриншот установки FileWatcher:

enter image description here

Есть мысли о возможной причине?

...