johndwells / minimee Goto Github PK
View Code? Open in Web Editor NEWMinimize & combine your CSS and JS files. Minify your HTML. Because size (still) DOES matter.
Home Page: http://johndwells.github.com/Minimee
Minimize & combine your CSS and JS files. Minify your HTML. Because size (still) DOES matter.
Home Page: http://johndwells.github.com/Minimee
Hi,
I am having the weirdest issue right now. If I do not include some of the tags like {exp:minimee:css}{/exp:minimee:css} or {exp:minimee:js}{/exp:minimee:js} the templates won't render at all but by just putting the tag pair, the template renders again.
Anyone with the same issue? I am using MSMinimee too on EE2.8.1
A PHP Error was encountered
Severity: 8192
Message: Non-static method Minimee::usage() should not be called statically, assuming $this from incompatible context
Filename: minimee/pi.minimee.php
Line Number: 12
I would like to be able to control the cache output path to //path/to/file.js.
It would be nice to also control the host.
For example, on my dev machine I have a host name set like: domain.dev as http and https.
It would be nice to have the output path be or // or http or https depending on how I access the website.
Also, on other devices in my network I use xip.io to resolve local hostnames but that changes the hostname to: domain.ext.192.168.0.2.xip.io. So on those devices the js and css is not loaded because it can't access the paths.
Hi John,
I've just been giving Minimee 2.0.1 a try. I want it to minify my HTML, and that's it.
I've added the config array and have the minify_html option set to yes, but when I reload my web page, nothing happens.
I've found that if I use the {exp:minimee:css} tag around a CSS file (even though I don't want to minify any CSS), my HTML minification does then work (even when minify_css is set to no).
So my questions are, should the HTML minification be working without me using the {exp:minimee:css} workaround above? Or should I be using another minimee tag to get the HTML minifcation to work?
I'm pretty new to using this so I'm probably just doing something wrong or missing something from the docs, but I thought I'd post here to double-check.
Thanks,
Stephen
Hi,
I recently ran into an issue with Minimee where it couldn't get files.
After some research, I found out that Minimee was blocked because cURL doesn't have any User-Agent parameter when trying to fetch files.
I think it's a good practice to set a User-Agent when using cURL.
It's common to block requests with no user agents as it's mostly crawlers or bots.
And you can also find it in your http logs if you ever need it at some point.
I'll be glad to make a pull request with that little modification.
What do you think ?
Using latest version of Minimee. Users in Chrome on Windows experience a blank screen.
I use Apache/Google module mod_pagespeed. GZIP is turned off and so is template caching.
Running latest version of Minimee with EE 2.5.3.
No issues with any other browser. Chrome on OSX for me is fine.
Nothing in template debugging to indicate issues.
Any idea? Browser caching issue?
A PHP Error was encountered
Severity: Warning
Message: Illegal string offset 'name'
Filename: minimee/pi.minimee.php
Line Number: 1367
JSMin also brakes the Modernizr and jQuery Placeholder libraries.
Both errors show:
TypeError: 'undefined' is not a function (near 'blah blah blah')
Sean
Hi John,
I'm running into a weird issue where minimee is bringing my EE site down. I keep getting the following error in my apache files.
PHP Fatal error: Maximum execution time of 90 seconds exceeded in /var/www/example.com/system/expressionengine/third_party/minimee/libraries/EpiCurl.php on line 85
PHP Warning: (null)(): 342 is not a valid cURL handle resource in Unknown on line 0
It used to work before, I started getting this issue after I upgraded my server, so I'm now running php5.6 and apache 2.4.10 if that helps?
At the moment I have had to disable minimee, but I'll love to get it back up asap.
May this be something for Minimee? http://www.totalserve.net.au/blog/post/automin-with-labjs-compatibility-for-deferred-javascript-parsing
Hi, John!
I just discovered that JS queue and HTML minify just works when the user is logged on EECMS 2.5.3.
add('{3858c10afec2f27d871f991ddb4808f00d43072b}', 'custom-scripts');
Thank you so much!
If the format of memory_limit
contains a unit character (M
,K
,G
), CSSmin::normalize_int
will try to multiply that string by the appropriate unit amount.
Under PHP 7.1, attempting to do so results in:
Notice: A non well formed numeric value encountered
which Craft considers sufficient to throw an exception and error out.
This doesn't cause an issue in previous versions of PHP:
$ php -v
PHP 5.5.38 (cli) (built: Jul 3 2017 15:16:35)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
$ php -r 'var_dump("1024M" * 1048576);'
int(1073741824)
$ php -v
PHP 5.6.31 (cli) (built: Aug 17 2017 11:33:10)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
$ php -r 'var_dump("1024M" * 1048576);'
int(1073741824)
$ php -v
PHP 7.0.22 (cli) (built: Aug 17 2017 11:29:35) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
$ php -r 'var_dump("1024M" * 1048576);'
int(1073741824)
$ php -v
PHP 7.1.8 (cli) (built: Aug 17 2017 11:34:56) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
$ php -r 'var_dump("1024M" * 1048576);'
Notice: A non well formed numeric value encountered in Command line code on line 1
int(1073741824)
Great work on V2 of Minimee John. One thing I've noticed is that when minify html is on, some big files (e.g. json data files) break and output nothing.
I'm guessing this has something to do with the size of the file after a certain point. Not a major problem, but thought I'd let you know.
Can the combined css and js files be gzipped?
Hey John,
I'm getting an error in Template Debugging saying that I'm missing my cache folder which isn't the case. I am using the config method with the extension turned off via EE Master Config from Focuslab and have replace the various values accordingly.
* The base path of your local source assets.
* Defaults to site's FCPATH
*/
'base_path' => $base_path,
/**
* The base URL of your local source assets.
* Defaults to $EE->config->item('base_url')
*/
'base_url' => $base_url,
/**
* An optional unique 'cachebusting' string to force Minimee to generate a new cache whenever updated.
*/
'cachebust' => '1.0.0',
/**
* The path to the cache folder.
* Defaults to site's FCPATH + '/cache'
*/
'cache_path' => $base_path . '/cache',
/**
* The URL to the cache folder.
* Defaults to $EE->config->item('base_url') + '/cache'
*/
'cache_url' => $base_url . '/cache',
This is on a local machine with an alias of local.mydomain.com
If I remove $base_path from $base_path . '/cache', I get just /cache in the error as expected.
Pretty darn sure everything is correctly setup though, as you can see from the error below Minimee is adding an extra base path
Minimee [ERROR]: Not configured correctly: your cache folder
C:/wamp/www/myfolder/public_html/C:/wamp/www/myfolder/public_html/cache does not exist.
Managed to find this buried in the log files
[Mon Jul 21 09:29:17.600725 2014] [:error] [pid 16408] [client 216.243.170.224:53666] PHP Fatal error: Maximum execution time of 90 seconds exceeded in /storage/xxx/www/public_html/cms/expressionengine/third_party/minimee/libraries/EpiCurl.php on line 98
[Mon Jul 21 10:00:42.909016 2014] [:error] [pid 15040] [client 216.243.170.211:56030] PHP Fatal error: Maximum execution time of 90 seconds exceeded in /storage/xxx/www/public_html/cms/expressionengine/third_party/minimee/libraries/EpiCurl.php on line 87
[Mon Jul 21 10:00:42.934535 2014] [:error] [pid 15040] [client 216.243.170.211:56030] PHP Warning: (null)( 345 is not a valid cURL handle resource in Unknown on line 0
[Mon Jul 21 10:00:42.934683 2014] [:error] [pid 15040] [client 216.243.170.211:56030] PHP Warning: (null)( 345 is not a valid cURL handle resource in Unknown on line 0
Had to disable Minimee for now but would be good to find a solution.
Can we add HTML async
attribute to the minified JS file?
I am having an issue disabling and enabling Minimee between environment using EE Master Config from Focus Lab LLC.
In my config.master.php
, I am using:
$env_config['minimee'] = array(
// Stripped down other config options for simplicity
'disable' => 'yes'
);
In my config.prod.php
, I am using:
$env_config['minimee'] = array(
// Not stripped
// this is the only config option I would like to change
// for the production environment
'disable' => 'yes'
);
I used a similar approach with Minimee v1, with the old config options and format, of course. When I set, the disable config option to 'no' in config.master.php
, everything works as expected! So, I am guessing there is a better way to override a single config option for the production environment only. Any ideas? For now, I am just enabling Minimee in all environments, so no rush. This is probably due to my lack of PHP knowledge :) Thanks!
Any plans to update this for EE3? Please ๐
Hi John,
Although HTML minification appears to be working, upon closer inspection, it appears as though it's not minifying as much as I'd expect it to be.
As an example, I did a quick test with the EE home page.
Here's the original source: http://pastie.org/private/gzp2r8apz5p6osplk14a
Here's the source when minimised using Minimee 2.0.1: http://pastie.org/private/xrkuehedgurxbvrp7jzbg
Here's the source when run through a random online HTML minifier I found (http://www.willpeavy.com/minifier/): http://pastie.org/private/fe6dvehuppejzwv4oqwrw (I had to cut this short as Pastie kept throwing me a 503 error with the full minimised source)
As you can see, Minimee only appears to be partially minimising the HTML. Here's a screenshot of the above three results when compared together - top is the original, middle is Minimee, and the bottom is minimised using the online HTML minifier: http://cl.ly/image/1M0b3r223i0C
What do you think about this? Is this by design, a bug, or could I be doing something wrong here?
Thanks,
Stephen
Hi John,
In Minimee 2.0.1, I've noticed that when using a single {exp:minimee:html} tag at the top of my template, the HTML minifies, but no cache folder is created.
Is this expected behaviour, or should a cache file be created?
My paths are setup correctly as if I surround a CSS file with the {exp:minimee:css} tag pair, a cache file is created for this.
For info, here's my config overrides:
$config['minimee'] = array(
'cache_path' => "${_SERVER['DOCUMENT_ROOT']}/min/",
'cache_url' => "http://${_SERVER['HTTP_HOST']}/min/",
'combine' => 'no',
'combine_css' => 'no',
'combine_js' => 'no',
'minify' => 'yes',
'minify_css' => 'no',
'minify_html' => 'yes',
'minify_js' => 'no'
);
So I just wanted to double-check with you so I know what to expect.
Thanks,
Stephen
John,
Testing Minimee 2 on some projects in development. When I have JSMinPlus selected, I get this error:
Parse error: Illegal token in file '[inline]' on line 1
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at
/usr/local/pem/vhosts/xxxxxxx/webspace/httpdocs/system/expressionengine/third_party/minimee/libraries/JSMinPlus.php:218)
Filename: core/Common.php
Line Number: 409
Sean
Since updating Minimee to 2.1.3 (from 2.1.1) I receive the following on Minimee completion:
(0.025716 / 3.84MB) Minimee [INFO]: Headers OK for file: '/css/dev/bootstrap.less'. (0.025808 / 3.84MB) Minimee [INFO]: Creating cache name from '/css/dev/bootstrap.less'. (0.025933 / 3.84MB) Minimee [INFO]: Cache file not found: '0a1cc9d4ff4a16dba5aaecdf72e5988f32b74432.1353460439.css' (0.026145 / 3.91MB) Minimee [INFO]: Fetched contents of '/css/dev/bootstrap.less'. (0.026180 / 3.91MB) Minimee [INFO]: Hook 'minimee_pre_minify_css' has been activated. (0.027202 / 4.14MB) Calling Extension Class/Method: Minimee_less_ext/minimee_pre_minify_css (0.027547 / 4.14MB) Minimee+LESS [INFO]: Running LESS on '/css/dev/bootstrap.less'. (0.761035 / 14.39MB) Minimee [INFO]: Running minification with Minify_CSS. (0.761104 / 14.39MB) Minimee [INFO]: PHP's include_path has been updated. (6.755053 / 14.63MB) Minimee [INFO]: Minification unable to reduce /css/dev/bootstrap.less, so using original content. (6.755612 / 14.54MB) Minimee [INFO]: Cache file '0a1cc9d4ff4a16dba5aaecdf72e5988f32b74432.1353460439.css' was written to /var/www/cache
It appears the CSS minifier is unable to minify the .less file (as you would expect). The raw LESS file is then served back to the browser: http://pastebin.com/UaLvPuCM
Let me know if I can help beyond this point. You probably already know more about how to fix this issue than I do. :-)
Hi,
I am using EE v2.5.2 and Minimee 2.1.3 for one of my project.I am able to load the internal css and js using Minimee,but not able to load external js files like jquery,twitter.js etc.
In the documentation (http://johndwells.github.com/Minimee/),it says
->cURL or file_get_contents() is required if using {stylesheet=} or external URLs
->If using file_get_contents(), PHP must be compiled with support for fopen wrappers (allow_url_fopen must be set to true in PHP.ini)
->If using file_get_contents() and combining/minifying files over https, PHP must be compiled with OpenSSL support.
But I could not found any example on how to load external js.There is an example on how load internal js like
{exp:minimee:js}
<script type="text/javascript" src="/js/mylibs/jquery.easing.js"></script>
<script type="text/javascript" src="/js/mylibs/jquery.cycle.js"></script>
<script type="text/javascript" src="/js/mylibs/jquery.forms.js"></script>
<script type="text/javascript" src="/js/scripts.js"></script>
<script type="text/javascript" src="/js/plugins.js"></script>
{/exp:minimee:js}
Can anyone please help me to load minified,cached and compressed external Js or CSS in my site.
I am using <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://platform.twitter.com/anywhere.js?id=IP6AovJx6H5NEZze1QQgDg&v=1" type="text/javascript"></script>I want these two js to be loaded using Minimee.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.