- This topic has 7 replies, 2 voices, and was last updated 2 years, 4 months ago by Tom.
-
AuthorPosts
-
December 12, 2021 at 3:01 am #2046255Longinos
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.
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.December 12, 2021 at 2:10 pm #2046806TomLead DeveloperLead DeveloperHi 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?
December 12, 2021 at 2:36 pm #2046817LonginosYes, 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 functcan_write()
after the$page_id
is set
andecho "<pre>".$id".</pre>"
inpage_id()
before thereturn $id;
When a post is updated this echoes nothing incan_write()
and the post id inpage_id()
.
These both functions are inclass-enqueue-css.php
file.
Incan_write()
if no$page_id
is set then fallback to inline.December 12, 2021 at 2:38 pm #2046819TomLead DeveloperLead DeveloperCan 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.
December 12, 2021 at 2:45 pm #2046821LonginosIn 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?
December 13, 2021 at 11:27 am #2047834TomLead DeveloperLead DeveloperAh 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 🙂
December 13, 2021 at 2:31 pm #2047964LonginosHi 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?December 13, 2021 at 2:52 pm #2047993TomLead DeveloperLead DeveloperBlock 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%.
-
AuthorPosts
- You must be logged in to reply to this topic.