• Resolved pixelmort

    (@pixelmort)


    Hi Frank,

    I enqueued my own CSS in a child theme functions.php. Everything works fine untill I switch on the CSS compression with Autoptimize plugin.
    The front page is blank and a message display with “connection error”.
    Usually I never encounter any issue ˉ\_(ツ)_/ˉ

    So, my question is: Does the wp_enqueue_style child theme function requiered a specific information for rolling peacefully with the CSS compression?

    Here an excerpt of my functions.php.

    function oxy_load_child_scripts() {
      wp_enqueue_style( THEME_SHORT . '-child-theme' , get_stylesheet_directory_uri() . '/style.css', array( THEME_SHORT . '-theme' ), false, 'all' );   
    
      // MY STYLE
        if ( is_front_page () ) {
              wp_enqueue_style( 'rotating-words', get_template_directory_uri() . '/../angle-child-theme/assets/css/rotating-words.css' );
        }
      }
      add_action( 'wp_enqueue_scripts', 'oxy_load_child_scripts');

    Thank you for your help and merry christmas!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Frank Goossens

    (@futtta)

    The blank page problem is probably due to the CSS-minification tool (https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port) is crashing on your child theme CSS. If the problem is only with the frontpage, then rotating-words.css is probably triggering something. This could be due to a problem with the CSS itself or a problem with the minification-tool. If you can provide me with (a link to) that file, I’ll be happy to have a look at what might be happening.

    frank

    Plugin Author Frank Goossens

    (@futtta)

    (you could, off course, also simply exclude rotating-words.css from CSS optimization)

    Thread Starter pixelmort

    (@pixelmort)

    Wow, awesome quick support for an awesome free plugin!
    I currently work on localhost…

    If you confirm me that wp_enqueue_style is correct, the problem should be probably mine. I inspect my CSS :/

    Thanks

    Plugin Author Frank Goossens

    (@futtta)

    well, wp_enqueue_style should work, so indeed something in rotating-words.css is indeed crashing the minifier (although the minifier might be to blame as well). you can also test on the CSS minificatoin on https://futtta.be/cssmin/gui/

    frank

    Thread Starter pixelmort

    (@pixelmort)

    Thanks for the link, I’ll give it a try.
    Have yourself a Merry Christmas!

    Thread Starter pixelmort

    (@pixelmort)

    Hi Frank,

    first let me thank you for the major update of Autoptimize.
    My problem of blank page disappears. I simply split the huge rotating-words.css into two files.
    I have no idea why this is working now, but this thead could be definitively closed.

    Regards!

    Plugin Author Frank Goossens

    (@futtta)

    happy to hear it works now pixelmort!

    regarding that rotating-words.css; what you would also do is minify it yourself and save it as rotating-words.min.css, in which case AO 2.0 would not try to minify it any more, but will inject it in the autoptimized file after the minification has been done.

    frank

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Child Theme – CSS Compression error’ is closed to new replies.