trentrichardson / cakephp-shrink

Shrink is a CakePHP plugin to Compile, Combine, Compress js, css, less, sass, coffee assets
16 stars 9 forks source link

Plugin isn't Minify .js files in CakePHP 3.0.3 #5

Closed ghost closed 7 years ago

ghost commented 8 years ago

I am using your plugin "Shrink CakePHP Plugin" but the plugin this unifying and minifying the .css files but not minifying the .js files (though this unifying all .js files), what the reason for this behavior and how to prevent this behavior?

How I'm using:

In my home.ctp (inside head tags):

<?= $this->Shrink->css(['Bootstrap/css/bootstrap.min.css', 'font-awesome-4.3.0/css/font-awesome.min.css', 'datepicker/css/datepicker.css', 'jquery-bxslider/jquery.bxslider.css', 'style.css', 'menu-plugin.css']) ?> <?= $this->Shrink->js(['jquery-1.11.1.min.js', 'bootstrap.min.js', 'Jquery-Validate/jquery.validate.min.js', 'datepicker/js/bootstrap-datepicker.js', 'jquery-bxslider/jquery.bxslider.min.js', 'main.js']) ?> <?= $this->Shrink->fetch('css') ?> <?= $this->Shrink->fetch('js') ?>

In AppController.php (inside initialize() method) I add this line:

$this->helpers[] = 'Shrink.Shrink';

danielignatius commented 8 years ago

I tried that as well. I can confirm that the plugin isn't minify the .js files.

riddlemd commented 7 years ago

If anyone needs this fixed changed open Shrink.php and edit line 70. Change if($cakedebug >= $this->settings['debugLevel']){ to if($this->settings['debugLevel']){ -- and in your helper settings the debugLevel now works like this: 0 = compressed, no debug, 1 = compressed with debug, 2 = no compression with debug.

This is fixed in my branch: https://github.com/riddlemd/cakephp-shrink (as of this post this plugin has not been updated in 2 years, so he may not merge my changes back)

trentrichardson commented 7 years ago

Thanks for posting the fix. After Christmas I will try to get this project up to speed.

On Dec 23, 2016 2:51 PM, "Michael Riddle" notifications@github.com wrote:

If anyone needs this fixed changed open Shrink.php and edit line 70 from if($cakedebug

= $this->settings['debugLevel']){ to if($cakedebug){ -- and in your helper settings the debugLevel now works like this: 0 = compressed, no debug, 1 = compressed with debug, 2 = no compression with debug.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/trentrichardson/cakephp-shrink/issues/5#issuecomment-269038285, or mute the thread https://github.com/notifications/unsubscribe-auth/AATHOGWqW8pVPtZKZsrCHK77g87ORCioks5rLCY5gaJpZM4FnQOW .

riddlemd commented 7 years ago

I've forked the project, feel free to pull my changes back in (sans composer file and readme)

trentrichardson commented 7 years ago

@riddlemd Thank you for posting your fixes. They are now in the cakephp-v3.0 branch. I'll try to do a good look over, run tests, and try to go ahead and get it merged to master.