With the “Excluded Resources” feature, you can tell NitroPack not to optimize:
To do so, you need to enable the feature from the General Settings panel and fill out a bit of information.
For external resources, you must enter the resource URL.
For inline resources, write down a single line of code that’s unique to the resource. NitroPack will recognize the line and exclude the entire resource.
Also, don’t include the <script> or <style> tag.
For example, to exclude this inline script:
Skip the <script> tags.
And choose one line of code that’s unique to the resource.
You can use the wildcard symbol * to match more than one resource with a single rule or to avoid writing the entire snippet.
In our example, we can exclude the script by entering document*cta-btn instead of the entire line of code.
If you have resources with dynamic parts in them (like dynamic URLs), you can also use the wildcard to match their dynamic parts.
Next, you can choose between the resource types we mentioned above.
You can also specify if the resource is external or inline.
An external resource is anything specified by the <src> or href (for external CSS) attributes. Conversely, an inline resource is located in the HTML markup. The first example in this article shows how to exclude an inline script.
By default, the resource will be excluded from optimization on all devices. You can also exclude it only for certain devices.
For instance, if you select “Mobile”, the specified resource will be optimized only on Desktop and Tablet devices.
If you don’t select an excluded operation, NitroPack will ignore the resource. It’ll be excluded from all forms of optimization, including our resource loading strategy.
You can change that by choosing one or more operations that you don’t want to be performed.
For more information on each of these, check out our article on Excluded Operations.
After filling out all the fields, remember to save your settings.