Closed jrean closed 9 years ago
Could you show me the code ? And the html source for the ouptut ?
Yes of course, thank you for your quick answer.
So first, I required the composer package.
"devfactory/minify": "1.0.*"
// composer update (on local)
Outputs:
- Installing natxet/cssmin (3.0.3)
Loading from cache
- Installing tedivm/jshrink (v1.0.1)
Loading from cache
- Installing devfactory/minify (1.0.1)
Loading from cache
Then I edited config/app.php
// Service Provider
Devfactory\Minify\MinifyServiceProvider::class,
// Alias
'Minify' => Devfactory\Minify\Facades\MinifyFacade::class,
Then I published the config file: `php artisan vendor:publish --provider="Devfactory\Minify\MinifyServiceProvider"
Outputs:
Copied File [/vendor/devfactory/minify/src/config/config.php] To [/config/minify.config.php]
Publishing Complete!
Then I updated the config/minify.config.php
// I want to test it on my local env
'ignore_environments' => array(
/* 'local', */
),
// Perfect to me
'css_build_path' => '/css/builds/',
// Perfect to me
'js_build_path' => '/js/builds/',
// My conf
'base_url' => env('APP_URL')
Then I created both '/css/builds' and '/js/builds' folders.
Then I tried my first attempt. I also have on my layout master.blade.php
a main.css
file.
So I replaced the call by {!! Minify::stylesheet('/css/main.css') !!}
In my page source code I have the following:
<link href="/css/builds/d30e521c267df109986130e9fc6cd58d1435137984.css" rel="stylesheet">
When I open the file I can see the minified CSS but my browser (Chrome Version 43.0.2357.124 (64-bit)
Mac) doesn't load them. When I try to inspect elements the minified are not used.
So I tried to clear all my caches.
php artisan view:clear
php artisan cache:clear
But unfortunately it doesn't change anything.
I hope I gave enough details :)
Did I do something wrong or missed something?
Thank you :)
UPDATE:
I can see the some minified CSS rules within the inspector tool but the majority are missing! This is weird.
I have:
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link href="/css/builds/d30e521c267df109986130e9fc6cd58d1435137984.css" rel="stylesheet">
And the Minified CSS file is the following:
body{background-color:#fbfbfb;color:#17161e;font-family:'Open Sans',sans-serif;font-size:18px;line-height:1.6;border-top:3px solid #e3c458}a,a:hover,a:focus,a:active,a:visited{color:inherit}.no-scroll{overflow:hidden}.text-golded{color:#e3c458}.section-heading-divider{display:block;width:70px;height:1px;margin:40px auto;border-top:4px solid #000}.acme-label-default{background-color:#777;font-size:65%}.acme-label-episode{background-color:#777;font-size:65%}.acme-label-intro{background-color:#e26000;font-size:65%}.acme-label-outro{background-color:#777;font-size:65%}.acme-label-key{background-color:#e3c458;font-size:65%}.acme-label-exercise{background-color:#7dc290;font-size:65%}.acme-badge{vertical-align:middle}.btn-acme-default,a.btn-acme-default{color:#fff;background-color:#e74430;border-color:#cc2b18}.btn-acme-default:hover,a.btn-acme-default:hover{color:#fff;background-color:#e3301a;border-color:#cc2b18}.btn-acme-default,a.btn-acme-default{color:#FFF;background-color:#17161e;border-color:#17161e}.btn-acme-default:hover,a.btn-acme-default:hover{background-color:#17161e;border-color:#17161e}.btn-acme-default-bordered,a.btn-acme-default-bordered{background-color:#FFF;border-color:#17161e}.btn-acme-default-bordered:hover,a.btn-acme-default-bordered:hover{color:#FFF;background-color:#17161e;border-color:#17161e}.btn-acme-green,a.btn-acme-green{color:#fff;background-color:#7dc290;border-color:#7dc290}.btn-acme-green:hover,a.btn-acme-green:hover{background-color:#7dc290;border-color:#7dc290}.btn-acme-green-bordered,a.btn-acme-green-bordered{background-color:#FFF;border-color:#7dc290}.btn-acme-green-bordered:hover,a.btn-acme-green-bordered:hover{background-color:#7dc290;border-color:#7dc290}.acme-fa-microphone{color:#aeaeae}.acme-mobile-nav{background:none;position:fixed;top:0;width:100%;z-index:100000;border-top:3px solid #e3c458}.acme-mobile-nav-logo{display:inline-block;width:100%;font-family:'Megrim', cursive;font-size:35px;text-align:center;margin:0}.acme-mobile-nav-logo a,.acme-mobile-nav-logo a:hover,.acme-mobile-nav-logo a:active{color:#e3c458;text-decoration:none}.acme-mobile-nav-menu-btn{position:absolute;margin:1px 0 0 0}.acme-mobile-nav-fa-bars{color:#FFF;padding-top:8px}.acme-mobile-nav-bg{background-color:#17161e}.acme-mobile-menu{background:#17161e;position:fixed;width:100%;min-height:100%;top:0;right:0;z-index:10000;text-align:center;padding:0 30px}.acme-mobile-menu-ct{color:#FFF;padding-top:90px}.acme-mobile-menu-ct h3{font-family:'Poiret One', cursive;font-weight:bold}.section-heading{font-family:'Poiret One', cursive;font-weight:bold;text-align:center}.acme-panel-default,.acme-panel-episode,.acme-panel-outro{border-top:4px solid #777}.acme-panel-intro{border-top:4px solid #e26000}.acme-panel-key{border-top:4px solid #e3c458}.acme-panel-exercise{border-top:4px solid #7dc290}.acme-panel .panel-heading{background-color:#FFF;border-bottom:none}.acme-panel .panel-heading h3{line-height:1.5;font-size:20px;font-weight:bold}.acme-panel .panel-body{font-size:16px}.acme-panel .panel-footer{background-color:#FFF;border-top:none}.acme-panel .panel-footer-meta{padding-top:12px;margin-bottom:0}.pagination li a{color:#17161e}.pagination li a,.pagination li a:hover{color:#17161e}.pagination .active span,.pagination .active span:hover{background-color:#17161e;border-color:#17161e}#acme{color:#FFF;background-color:#17161e;padding:50px 0;margin:40px 0}#acme h2{font-size:35px;font-family:'Poiret One', cursive;text-align:center;margin-bottom:20px}#acme-portrait{text-align:center}#acme-portrait img{width:153px;height:153px;border-radius:50%;border:2px solid #FFF}#acme p{color:#ccc;font-size:18px;line-height:1.6;padding:0 10px}#your-voice{margin-top:30px}.your-voice-btn{margin-top:20px}.acme-social li{display:inline-block}.acme-social li:nth-child(1){margin-right:80px}footer{margin-top:60px;padding-bottom:60px;text-align:center}footer > div:nth-child(1) > div > ul > li{display:inline-block;margin-right:10px}footer > div:nth-child(1) > div > ul > li > a{color:#525252;font-size:18px}#credits{margin-bottom:0;color:#aeaeae;font-size:16px;text-align:center}#gr33ts{margin-bottom:0;color:#c8c8c8;font-size:14px;text-align:center}@media min-width:768px){.acme-navbar-default{background:none;padding-top:20px;border:none;border-top:3px solid #e3c458;margin-bottom:0}.acme-navbar-default .navbar-brand{color:#e3c458;font-family:'Megrim', cursive;font-size:35px}.acme-navbar-default .acme-navbar-item{color:#fbfbfb;font-size:16px}.acme-navbar-default .acme-navbar-item:hover,.acme-navbar-default .acme-navbar-item:active,.acme-navbar-default .acme-navbar-item:focus{background:none;text-decoration:underline}.acme-nav-bg{background-color:rgba(23,22,30,.85);padding-top:0}.panel-serie{position:relative;height:400px}.panel-episode{position:relative;height:500px}.acme-panel .panel-footer{position:absolute;width:100%;bottom:0}#your-voice{margin-top:40px}.your-voice-btn{margin-top:40px}}@media min-width:992px){.panel-serie{height:410px}.panel-episode{height:550px}}@media min-width:1200px){.panel-serie{height:380px}.panel-episode{height:485px}}
Hi,
I never saw the service provider and the alias with you syntax:
// Service Provider
Devfactory\Minify\MinifyServiceProvider::class,
// Alias
'Minify' => Devfactory\Minify\Facades\MinifyFacade::class,
Could you try to use :
// Service Provider
'Devfactory\Minify\MinifyServiceProvider',
// Alias
'Minify' => 'Devfactory\Minify\Facades\MinifyFacade',
Otherwise I didn't know why, everything look like fine.
I will try. This syntax is shipped with Laravel 5. I will try and keep you posted.
Hi I'm using 5.1 too where should I make the css/builds folder on my public folder?
Yes you have to create the forlder in the public folder
So know if the build directory don't exists, minify will try to create the build directory, is in the version 1.0.2
Hi, I followed each steps in the documentation. The minified css are generated in the /css/builds folder and loaded and present in the final html source file. But they are not loaded by the browser!
I deleted all caches but it is not working.
Any idea? Did I miss something?
Laravel 5.1
Thank you.