• Resolved siparker

    (@siparker)


    after installing some pages show in the google amp test as being invalid. it says the max css size is 75000 bytes and we are way over that.

    I read through your optimisation guide and enabled the minify css and this helped a little but is still oversized.

    I then enabled the tree shaking feature and this made the file size bigger than it was previously.

    It appears that the plugin includes all of the css files within Divi. many of which are probably not required.

    Is there a known good way to make your plugin work with Divi. As our only option at the moment it seems is to modify the plugin to not include any css and write custom css ourselves that will style the page.

    How would you recommend customising the css on a per page basis for the plugin to give a result under the 75k byte limit?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, Sorry for the inconvenience caused you. Can you please kindly share the URL of the issue if possible? So that we will check the issue by going through it and assisting you to fix the issue.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, Can you please kindly share the URL of the issue if possible? So that we will check the issue by going through it and assisting you to fix the issue.

    Thread Starter siparker

    (@siparker)

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, Thank you for sharing the URL. Can you please kindly share with us the exported AMP optional panel settings once? So that we will import it at our end and check the issue once and get back to you accordingly to resolve it.

    Here is the reference tutorial of it: https://ampforwp.com/tutorials/article/how-to-import-and-export-the-amp-option-panel-settings/

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, Can you please kindly share with us the exported AMP optional panel settings once? So that we will import it at our end and check the issue once and get back to you accordingly to resolve it.

    Here is the reference tutorial of it: https://ampforwp.com/tutorials/article/how-to-import-and-export-the-amp-option-panel-settings/

    Thread Starter siparker

    (@siparker)

    Hi, We have sorted this by modifying the plugin to look at a custom field and adding the correct css into there.

    Could you add in functionality to have per page css for the amp plugin

    we added it via

    <style amp-custom>
                <?php if( get_field( 'amp_custom_css' ) ) : ?>
                    <?php $custom_css = get_field( 'amp_custom_css' ) ?>
                <?php else: ?>
                    <?php $thisTemplate->load_parts( array( 'style' ) ); ?>
                    <?php do_action( 'amp_post_template_css', $thisTemplate ); ?>
                    <?php do_action( 'amp_css', $thisTemplate ); ?>
                    <?php $custom_css = ampforwp_get_setting('css_editor');
                    if (function_exists('heateor_sss_run') && ampforwp_get_setting('ampforwp_css_tree_shaking') ) {
                          global $wp_filesystem;
                          if(!is_object($wp_filesystem)){
                                require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php';
                                require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php';
                                $wp_filesystem = new WP_Filesystem_Direct( array() );
                            }
                          $custom_css .= $wp_filesystem->get_contents(AMPFORWP_PLUGIN_DIR."/includes/sassy-style-optimized.css");
                    }
                endif;
                $custom_css = str_replace(array('.accordion-mod'), array('.apac'), $custom_css);
                $sanitized_css = ampforwp_sanitize_i_amphtml($custom_css);
                echo $sanitized_css; // sanitized above */ ?>
            </style>
    
    

    If you could add a filter to the sanitized css so before it is echoed it can be filtered that would probably do what we need also.

    its not great at the moment as if the plugin is updated our changes obviously have to be redone.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, Thank you for the info, and sorry for the delay in response extremely. Regarding this filter to modify the unused CSS, we have raised the GitHub ticket in our AMPforWP repository. We will implement this filter in the upcoming milestone 1.0.88. Once it gets pushed then we will get back to you with an update.

    Here is the reference GitHub ticket to track the updates: https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/5478

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, hope you’re doing well. We’ve released a new update, so kindly update the plugin with the new version 1.0.92 and give it a try. Please feel free to reach out to us if you have any concerns

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘CSS to large and gets bigger with optimisation’ is closed to new replies.