Giter Club home page Giter Club logo

minimee's Introduction

#Minimee2

Minimize, combine & cache your CSS and JS files. Minify your HTML. Because size (still) DOES matter.

Description

"Minimee combines and compresses JavaScript and CSS files, thereby reducing file sizes and HTTP requests, and turning your puddle of online molasses into a digital fire hose."
- Stephen Lewis, founder, Experience Internet

Minimee watches your filesystem for changes to your CSS & JS assets, and automatically combines, minifies & caches these assets whenever changes are detected. It can also detect changes to stylesheet templates (whether saved as files or not).

Version 2's substantial re-write has ushered in a host of changes big and small. It is the same Minimee you've come to rely on, with more power, intelligence, and fun-ness.

Minimee is inspired and influenced by SL Combinator from Experience Internet, and Carabiner Asset Management Library from Tony Dewan.

Companion Add-Ons

The architecture of Minimee2 has given me the opportunity to build other add-ons that extend Minimee's capabilities. So if you're curious, have a look at:

  • MSMinimee - a module that brings full MSM-compatibility to Minimee

Want Bleeding Edge?

The master branch will always contain the "stable" release of Minimee, where the version number should match what is listed on the Full Documentation page, as well as on @devot-ee and on my personal website.

To follow development of Version 2.x, refer to the version2 branch. Note that version increments will always happen at the master branch first.

minimee's People

Contributors

johndwells avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

minimee's Issues

Question: Overriding disable config option

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!

EE3

Any plans to update this for EE3? Please ๐Ÿ‘

Error with PHP 5.5

A PHP Error was encountered
Severity: Warning
Message: Illegal string offset 'name'
Filename: minimee/pi.minimee.php
Line Number: 1367

Minify html breaks large files

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.

Illegal token in file '[inline]' (v2 beta)

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

HTML only partially minifying

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

Site not loading with Minimee active

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.

Using minify_html on its own

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

Blank screen in Chrome

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?

Blank page on templates without minimee tags

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

define host / scheme / relative path for agnostic paths

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.

Add a user-agent when using cURL

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 ?

Should minified HTML be cached?

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

Error in PHP 5.6

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

Cache Folder missing? (v2 beta)

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.

JS queue when user logged_out

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!

site won't render with minimee enabled

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.

How to cache,minify and compress external js and css

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

Failure parsing `memory_limit` PHP 7.1

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)

Minimee+LESS integration - "Unable to reduce" issue

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. :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.