skeeks-semenov / yii2-assets-auto-compress

Automatic compilation of js + css + html
https://skeeks.com/
BSD 3-Clause "New" or "Revised" License
157 stars 43 forks source link

Included uncompressed JS files reappearing with compressed file #40

Closed atishhamte closed 5 years ago

atishhamte commented 6 years ago

Hello,

I have faced this problem with JS compression. Even though all JS files are compressed, the original JS files get appended before it. So I have done some modifications in code and it worked.

Changes are done in AssetAutoCompressComponent.php in _processingJsFiles() function The new code is at line 362

if (file_exists($rootUrl)) { $resultFiles = [];

        foreach ($files as $fileCode => $fileTag)
        {
            if (Url::isRelative($fileCode))
            {
            } else
            {
                if (!$this->jsFileRemouteCompile)
                {
                    $resultFiles[$fileCode] = $fileTag;
                }
            }
        }

        $publicUrl                  = $publicUrl . "?v=" . filemtime($rootUrl);
        $resultFiles[$publicUrl]    = Html::jsFile($publicUrl, $this->jsOptions);
        return $resultFiles;
    }

Kindly make changes in original repo.

skeeks-semenov commented 6 years ago

These edits are already in the master branch. Install skeeks/yii2-assets-auto-compress:dev-master

A little later I will release

skeeks-semenov commented 6 years ago

https://github.com/skeeks-semenov/yii2-assets-auto-compress/blob/master/CHANGELOG.md#130pre

skeeks-semenov commented 6 years ago

https://github.com/skeeks-semenov/yii2-assets-auto-compress/blob/master/AssetsAutoCompressComponent.php#L369