Step 3: In the “JavaScript Files” section, you’ll find minimizing JavaScript files, deferring JavaScript loading, and delaying JavaScript execution. When you activate any of these options, a text field labeled “Exclude JavaScript Files” will appear.
Step 4: For each selected option paste
/wp-content/plugins/beautiful-and-responsive-cookie-consent-addon/(.*)
/wp-content/plugins/beautiful-and-responsive-cookie-consent/(.*)
into the text field labeled “Exclude JavaScript Files”. This will exclude the JavaScript files from being optimized.
Reminder: Those scripts need to be excluded from ALL JavaScript optimisations, e.g. deferred, minimizing or any other available option.
Step 5: Go to “Combine JavaScript files” and add in the Excluded Inline JavaScript field the following:
nsc_bara_blocking_scripts_inline
nsc_bara_blocking_scripts
nsc_bara_consent_mode_default_script
nsc_bara_consent_mode_update_script
nsc_bar_get_dataLayer_banner_init_script
nsc_bar_nice-cookie-consent_js
Step 6: Add Cookie Banner CSS to safelist
If you have enabled the “remove unused CSS” in WP-Rocket, see here https://docs.wp-rocket.me/article/1529-remove-unused-css#css-safelist, add this ID to the safelist to exclude it from optimizing:
nsc_bar_nice-cookie-consent-css
nsc_bar_nice-cookie-consent-inline-css
cc-main
cm__body
Step 7: Now save your changes. There shouldn’t be any issues now with your cookie banner. If you still have any issues please check the WP Rocket documentation: https://docs.wp-rocket.me/category/1231-file-optimization or contact support.