Reimplements HtmlParser using Symfony DomCrawler #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes the RegEx-based parser and replaces it with PHP's HTML parser. Additionally, this PR utilizes Symfony's DomCrawler component to target the HTML nodes that should have their CSS class properties updated. Symfony's CssSelector component is also used to support more complex CSS-like selectors.
Backwards Compatibility
This PR maintains the existing configuration format, and converts them to their appropriate CSS style selectors. All existing test behavior has been preserved (with minor test changes to reflect the differences in how the emitted HTML attributes are ordered in the output).
An example of HTML attributes being emitted in a different order is:
Improved Nested Element Support
This PR resolves #16 , and allows for deeply nested class configurations to be specified:
The above configuration could be used to produce output similar to the following example:
By utilizing more complicated CSS-style selectors, developers may now be more specific in how they apply their CSS classes:
Would produce the following output:
Improvements to CSS Framework Build Tooling Workflows
Additionally, this PR offers a solution for #20. While this PR does not directly solve the issue, it provides a new Artisan command that can be used to produce a JavaScript configuration file containing all of the Classify class names:
This command will create a new
classify.config.js
file at the root of the project, with contents similar to:This new configuration file can then be used to configure the CSS build process. For example, a Tailwind CSS version 3 configuration file could be updated to the following: