public final class ConditionalsCollector extends Object implements DependentPlugin
ConditionalAtRuleBlock
s, from the Conditionals
plugin.
This should be used when you want to determine which conditions are utilized within the source. This automatically enables the
Conditionals
plugin.
Note: The Conditionals
plugin lower-cases all conditions for comparison purposes, so usually
any arguments passed to methods of this class should be passed in lower-cased as well.
Constructor and Description |
---|
ConditionalsCollector() |
Modifier and Type | Method and Description |
---|---|
void |
conditional(ConditionalAtRuleBlock block)
Subscription method - do not call directly.
|
void |
dependencies(PluginRegistry registry)
Registers plugin dependencies.
|
ConditionalsCollector |
excludeNegationOnly(boolean excludeNegationOnly)
Specify true to ignore conditions that are only used with the negation operator (e.g.,
!ie9 ). |
com.google.common.collect.ImmutableSet<String> |
foundConditions()
Returns a copy of the set of found conditions.
|
boolean |
hasCondition(String condition)
Gets whether the given condition was found.
|
public void dependencies(PluginRegistry registry)
DependentPlugin
Any plugins you add to the registry in this method will be ordered before this plugin itself.
Keep in mind that only one instance of a plugin can be added in a single parsing operation. You can use PluginRegistry.require(Class)
, PluginRegistry.require(Class, Supplier)
and PluginRegistry.retrieve(Class)
to assist in scenarios where a plugin instance may have already been added.
Dependencies to include can range from refinement dependencies such as SelectorPlugin
and MediaPlugin
to
other custom plugins.
dependencies
in interface DependentPlugin
registry
- The PluginRegistry
instance.PluginRegistry.require(Class)
,
PluginRegistry.require(Class, Supplier)
,
PluginRegistry.retrieve(Class)
public ConditionalsCollector excludeNegationOnly(boolean excludeNegationOnly)
!ie9
).
In some cases you may not care about conditions only referenced in this way. For example, if you were using this plugin to determine which permutations to create based on which conditions are referenced, you wouldn't want the conditions only used with negation, as you would not need to generate permutations for those conditions.
This method should only be called before parsing has begun.
excludeNegationOnly
- Whether to ignore conditions only used with the negation operator.public void conditional(ConditionalAtRuleBlock block)
block
- The conditional at-rule block instance.public boolean hasCondition(String condition)
condition
- Check if this condition was found. This should be lower-cased.public com.google.common.collect.ImmutableSet<String> foundConditions()
Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.