Jump to content

Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML


David Karich

Recommended Posts

I think it's safe but check on dev installation first. I'm still using the old version on my few websites, with just a few fixes (although not sure which ones) - don't fix if ain't broken mantra :-). A colleague is running the new version, but he isn't using minimizing js/css functions; he uses just caching operations, no problems in last 2 months. But he just informed me that when he access the module settings in admin, it takes a long time to see the settings - I never had any problems, will report back if he finds what could be the problem.

Link to comment
Share on other sites

  • 10 months later...
On 9/26/2020 at 3:15 PM, Sevarf2 said:

Hello, I'm having a strange issue, the module works fine in production mode, but when I enable the $config->debug = true; the module cannot compile my files and output this error

 

<b>Warning</b>:  A non-numeric value encountered in <b>/site/assets/cache/FileCompiler/site/modules/AllInOneMinify/AllInOneMinify.module</b> on line <b>713</b><br />/site/assets/aiom/css_b636f2192ceb48c592835de3c2d9c3b9_dev.css?no-cache=1601104220">



Any idea how to solve this? Thanks

This error also happens with PHP 8.

Modify line 707

$_timestamp = '';

to

$_timestamp = null;

Solve the error.

Gideon

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

  • 2 years later...
  • 3 months later...

In the document html head tag:

        if (!empty($jshead)) echo '<script src="'.\AIOM::JS($jshead).'"></script>';
        if (!empty($jsfoot)) echo '<script src="'.\AIOM::JS($jsfoot).'" defer></script>';

... both lines render the same file, containing only one of the files in the respective arrays (each array has one item, it only contains the 1st)? What am I doing wrong?

Also, including @import google fonts begets the following error:

PHP Warning: Trying to access array offset on value of type null in .../processwire/site/modules/AllInOneMinify/lib/Less/Less.php:5746

No error if I include the compiled CSS instead of LESS, but @import is used in the README examples?

Link to comment
Share on other sites

Updating less.php got rid of the aforementioned LESS error though the fonts don't load anyway.

Changed the JS method allowing for a second call to generate JS to be deferred:


    public static function JS($javascripts, $js2 = false) {

        // ------------------------------------------------------------------------
        // Check if at least one file was passed.
        // ------------------------------------------------------------------------
        if(empty($javascripts)) throw new WireException('There were no files specified to minimize.');

        // Support passing of $config->scripts as argument which is of type FilenameArray
        if(($javascripts instanceof FilenameArray))
            $javascripts = (array) $javascripts->getIterator(); // Convert to array

        // ------------------------------------------------------------------------
        // Check if files exist and generating the cache file name based 
        // on the last editing of the file.
        // ------------------------------------------------------------------------
        $javascripts    = is_array($javascripts) ? $javascripts : array($javascripts);
        $javascripts    = self::_fileArray($javascripts, '.js');
        $cacheFile      = self::_getCacheName($javascripts, self::$jsCachePrefix . ($js2 ? '2' : ''), '.js');

 

Edited by hellomoto
add js to defer
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...