Jetpack::implode_frontend_css PHP Method

implode_frontend_css() public method

Pros: - Uses only ONE css asset connection instead of 15 - Saves a minimum of 56k - Reduces server load - Reduces time to first painted byte Cons: - Loads css for ALL modules. However all selectors are prefixed so it should not cause any issues with themes. - Plugins/themes dequeuing styles no longer do anything. See jetpack_implode_frontend_css filter for a workaround For some situations developers may wish to disable css imploding and instead operate in legacy mode where each file loads seperately and can be edited individually or dequeued. This can be accomplished with the following line: add_filter( 'jetpack_implode_frontend_css', '__return_false' );
Since: 3.2
public implode_frontend_css ( $travis_test = false )
    public function implode_frontend_css($travis_test = false)
    {
        $do_implode = true;
        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
            $do_implode = false;
        }
        /**
         * Allow CSS to be concatenated into a single jetpack.css file.
         *
         * @since 3.2.0
         *
         * @param bool $do_implode Should CSS be concatenated? Default to true.
         */
        $do_implode = apply_filters('jetpack_implode_frontend_css', $do_implode);
        // Do not use the imploded file when default behaviour was altered through the filter
        if (!$do_implode) {
            return;
        }
        // We do not want to use the imploded file in dev mode, or if not connected
        if (Jetpack::is_development_mode() || !self::is_active()) {
            if (!$travis_test) {
                return;
            }
        }
        // Do not use the imploded file if sharing css was dequeued via the sharing settings screen
        if (get_option('sharedaddy_disable_resources')) {
            return;
        }
        /*
         * Now we assume Jetpack is connected and able to serve the single
         * file.
         *
         * In the future there will be a check here to serve the file locally
         * or potentially from the Jetpack CDN
         *
         * For now:
         * - Enqueue a single imploded css file
         * - Zero out the style_loader_tag for the bundled ones
         * - Be happy, drink scotch
         */
        add_filter('style_loader_tag', array($this, 'concat_remove_style_loader_tag'), 10, 2);
        $version = Jetpack::is_development_version() ? filemtime(JETPACK__PLUGIN_DIR . 'css/jetpack.css') : JETPACK__VERSION;
        wp_enqueue_style('jetpack_css', plugins_url('css/jetpack.css', __FILE__), array(), $version);
        wp_style_add_data('jetpack_css', 'rtl', 'replace');
    }
Jetpack