Hi Matthew,
Thank you for your interest in NitroPack! We have good news for you – this option already exists. 🙂
The attribute is nitro-exclude
and everything else is the same as your example. It also works on all types of resources, not only JS.
Regards!
Hi again @silvenatodorova !
Nice! I want to do some tests with our plugin. Is it possible to get a developer license without any costs? 😊
Hello Matthew,
Thanks for asking! We haven’t got a developer license, but you can use our free plan instead: https://support.nitropack.io/hc/en-us/articles/360062731413-NitroPack-s-Free-Plan
Let us know if you need any further information regarding NitroPack.
Best regards!
Hi again @silvenatodorova !
Thanks for your follow-up.
Is there an API in PHP to flush the cache?
Regards
Matthew 😃
Hello @mguenter ,
The easiest way to do it would be with a cron job along with WP CLI. The command itself for WP CLI would be:
wp NitroPack purge --purge-url=https://domain.com/page
Then the cron job, for example, once a day:
0 0 * * * /path/to/wp-cli/wp --path=/path/to/your/website NitroPack purge --purge-url=https://domain.com/page
The paths in the cron job would need to be adjusted based on where WP CLI is installed on the server, and the path to your website as well.
This should be fairly straightforward to set up if you check with your hosting’s support.
Alternatively, you can integrate our API in a PHP script by following our documentation here:
> https://docs.nitropack.io/
Hope this information helps!
Hi again @nitronikol !
Sorry, but I have to open the ticket again.
I have now implemented the exclude so far, and it works quite well. Unfortunately, no inline scripts created with wp_localize_script
can be excluded.
Why? WordPress does not offer a filter to modify the <script
tag via e.g. script_loader_tag
. Is there also a directive to exclude this within an inline script?
Example:
<script id="myhandle-js-extra">
var myHandle = /* nitro-exclude */ {};
</script>
Or do you have any other idea? Otherwise, we need to add the following rule to NitroPack:
flameshot_screenshot
Regards,
Matthew 🙂
Hey @nitronikol !
More and more customers are asking for compatibility with NitroPack, but we need to exclude the inline script without tag, but with a comment in the inline script itself. Any chance to implement something like this? 🙂