-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Some TailwindCSS classes are not found when they are only existing in back-office (example: text styles, width/height/padding classes...)
To enhance the scan detection, it's possible to scan WP Rocket generated html cache files to find some classes which were only available in there.
Proof of concept using the Pilo'Press filter: pip/tailwind_api/content_to_scan
:
(tested on Sunna)
// Tell Pilo'Press to scan WP Rocket cache files to find missing TailwindCSS classes
add_filter( 'pip/tailwind_api/content_to_scan', 'scan_cache_files_for_tailwind_classes' );
function scan_cache_files_for_tailwind_classes( $contents_to_scan ) {
// Home page
$contents_to_scan[] = trailingslashit( WP_CONTENT_DIR ) . 'cache/wp-rocket/**/*.html';
// First level (posts / pages)
$contents_to_scan[] = trailingslashit( WP_CONTENT_DIR ) . 'cache/wp-rocket/**/**/*.html';
// Second level (post-types / terms)
$contents_to_scan[] = trailingslashit( WP_CONTENT_DIR ) . 'cache/wp-rocket/**/**/**/*.html';
return $contents_to_scan;
}
Those 3 new paths should be added here:
PiloPress/includes/classes/admin/modules/class-tailwind.php
Lines 819 to 832 in ff1e79e
$purge_content = array( | |
$theme_path . '*.php', | |
$theme_path . '**/*.php', | |
$theme_path . 'acf-json/*.json', | |
PIP_THEME_LAYOUTS_PATH . '**/*.php', | |
PIP_THEME_LAYOUTS_PATH . '**/*.css', | |
PIP_THEME_LAYOUTS_PATH . '**/*.js', | |
PIP_THEME_LAYOUTS_PATH . '**/*.json', | |
$theme_path . 'safelist.txt', | |
$theme_path . 'style.css', | |
$theme_path . 'pilopress/assets/styles.css', | |
); | |
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request