[Support request] Generateblocks can´t generate css files

Home Forums Support [Support request] Generateblocks can´t generate css files

Home Forums Support Generateblocks can´t generate css files

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2046255
    Longinos

    Hi
    I open this ticket as per Tom request.
    Read the wordpress.org support thread
    https://wordpress.org/support/topic/cant-generate-css-files/#post-15154591
    I put here 3 images:
    1.- The GPP elements created with Generateblocks for post navigation
    2.- The inlined css
    3.- The generateblocks config set to file.

    Images for generatepress support


    The site is in the private area, you can see this element and the inlined css in all post.
    No /uploads/generateblocks/ files are created.

    #2046806
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    So the main issue here is that the file isn’t being created? The CSS itself is building correctly, it’s just inline vs external.

    If so, what happens if you add a test GenerateBlocks Button to that post? Does it build an external file?

    #2046817
    Longinos

    Yes, the issue is file isn´t created.
    I added a generateblocks button to a post and the file still not created.
    I have put:
    echo "<pre>".$page_id".</pre>"; in the funct can_write() after the $page_id is set
    and echo "<pre>".$id".</pre>" in page_id() before the return $id;
    When a post is updated this echoes nothing in can_write() and the post id in page_id().
    These both functions are in class-enqueue-css.php file.
    In can_write() if no $page_id is set then fallback to inline.

    #2046819
    Tom
    Lead Developer
    Lead Developer

    Can you share the post where you’ve added the Button?

    I ask because the file writing is bypassed completely if no blocks exist in the content.

    #2046821
    Longinos

    In the url posted in private, you can see a blue button with link to #.

    I will come to this tomorrow because here is late at nigth.

    EDIT: So when generateblocks is in a element applied to the post no file is generated?

    #2047834
    Tom
    Lead Developer
    Lead Developer

    Ah I think I see the issue. We default to inline inside single posts to prevent people from having hundreds of CSS files built on their server. There are usually a lot more posts than pages on a website.

    You can change this default like this:

    add_filter( 'generateblocks_css_print_method', function( $method ) {
        if ( is_single() ) {
            $method = 'file';
        }
    
        return $method;
    } );

    Let me know if that helps or not 🙂

    #2047964
    Longinos

    Hi Tom
    So by default only in pages are file created, in pages where content have a generateblocks block, don´t aplies to geneteblocks block in elements applied to pages, is this rigth?

    #2047993
    Tom
    Lead Developer
    Lead Developer

    Block Elements should be treated like regular content. I’ll have to test whether they will force a file generation if no other blocks exist on the page – I believe they will but can’t say 100%.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.