rmrevin / yii2-minify-view

Yii2 View component with minification css & js
MIT License
191 stars 67 forks source link

Some 'js' is not minified #26

Closed newerton closed 8 years ago

newerton commented 8 years ago

image

The last 4 files is not minified, because the file already exists.

newerton commented 8 years ago

First, sorry for my English.

I found a problem in the order of the files. My $js:

public $js = [
        'vendor/bower/isotope/dist/isotope.pkgd.min.js',
        'vendor/bower/desandro.masonry/dist/masonry.pkgd.min.js',
        'vendor/bower/desandro.imagesloaded/imagesloaded.pkgd.min.js',
        'http://maps.google.com/maps/api/js?sensor=false',
        'vendor/bower/gmap3/dist/gmap3.min.js?sensor=false',
        'js/jquery/jquery-migrate-1.2.1.min.js',
        'js/site/main.js'
];

The file 'http://maps.google.com/maps/api/js?sensor=false' is not minify. The other files under him, was not included, why entered the 'else' on line 245 of file view.php. Removing the 'else', has solved the problem.

Another problem, and the query string with javascript, in line 288, the 'file_get_contents' does not identify files with query string. My solution was to add a function within the 'file_get_contents':

$js .= file_get_contents(reset((explode('?', $file)))) . ';' . PHP_EOL;
rmrevin commented 8 years ago

Try to install the latest version of the extension. If this does not work, send your configuration and asset bundles.

newerton commented 8 years ago

@rmrevin I'm debugging locally, you have a problem? Identified that is generated locally one minified file, the server is generated 2 minified file.

newerton commented 8 years ago

I thought the problem was in the variable $baseUrl the class AppAsset.php.

I was duplicating the way. The correct path is: F:\www\newerton\newerton\assets\ Returning: F:\www\newerton\newerton\newerton\assets\

Correction in my class.

public $baseUrl = !YII_ENV_DEV ? '@web' : '';
rmrevin commented 8 years ago

I'm glad I was able to solve the problem.