• Hello

    I’m using generateblock and generatepress to create my website and am very happy with the results so far. In addition to the core 4 elements that comes with generateblocks I’ve utilized 3 core Gutenberg elements namely, paragraph, list and images.
    I see this .css being rendered on every page wp-block-library-css of the website as well as on woocommerce catalog.
    This CSS belongs to the Gutenberg block library and which I believe (not a CSS expert) might contain irrelevant amount of styles not applicable in my use case scenario, such as image-gallery, column styles, etc.

    I used the following code in functions.php of child theme to deque the library:

    add_action( 'wp_enqueue_scripts', 'remove_block_css', 100 );
    function remove_block_css() {
    wp_dequeue_style( 'wp-block-library' ); // WordPress core
    wp_dequeue_style( 'wp-block-library-theme' ); // WordPress core
    wp_dequeue_style( 'wc-block-style' ); // WooCommerce
    wp_dequeue_style( 'storefront-gutenberg-blocks' ); // Storefront theme
    }

    Upon doing so, I didn’t notice any major issues however some image alignments were off and a small subheading (used as paragraph) was not aligned as well.
    I immediately replaced some paragraphs that needed alignment with the heading elements and changed their type to ‘p’.
    However, I’m still confused as to how should I replace the image elements with something offered by core generateblock elements.

    Hence, my two questions:

      Is it advisable to remove the library, if a user has no business with Gutenberg elements, except paragraph and image elements, in doing so possibly reducing 1000s of requests for websites with a fair amount of traffic? Can this have any detrimental effect in future, possibly breaking things down? I just wish to make the website as efficient as possible and remove redundant assets in that process.

      How can I use images and insert them using generateblocks? Possibly, a silly question, as I couldn’t find a creative way to insert images using generateblocks only.

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Tom

    (@edge22)

    Hi there,

    I believe the block editor team is working on this – loading that entire file of CSS is definitely not necessary.

    As you’ve noticed, you may need to add some custom CSS that’s necessary for your used blocks, but I don’t think you’ll run into many other issues.

    GB doesn’t have a custom image block – you should be using the core image block inside your GB blocks.

Viewing 1 replies (of 1 total)

The topic ‘Dequeuing/remove Gutenberg Block Library CSS’ is closed to new replies.