Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vecerek/css_compare
Evaluates and compares 2 CSS files based on their AST.
https://github.com/vecerek/css_compare
Last synced: about 1 month ago
JSON representation
Evaluates and compares 2 CSS files based on their AST.
- Host: GitHub
- URL: https://github.com/vecerek/css_compare
- Owner: vecerek
- License: mit
- Created: 2016-04-07T16:06:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-05-14T20:35:35.000Z (over 8 years ago)
- Last Synced: 2024-10-08T23:16:59.917Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 73.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# CSS Compare
Processes, evaluates and compares 2 CSS files based on their AST. The repository has been created in order to be able to test the [less2sass](https://github.com/vecerek/less2sass) project. The program returns `true` or `false` to the `$stdout`, so far.
Uses the Sass parser to get the CSS files' AST.Supported CSS features:
- all types of selectors (they are normalized - duplicity removal and logical/alphabetical ordering)
- @media, partially
- @import (lazy loading of imported css files, that can be found, otherwise ignored)
- @font-face
- @namespace
- @charset
- @keyframes
- @page
- @supports, partially## Installation
Add this line to your application's Gemfile:
```ruby
gem 'css_compare'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install css_compare
## Usage
Command line usage:$ css_compare
Programmatic usage:```ruby
opts = {
:operands => ["path/to/file1.css", "path/to/file2.css"]
}
result = CssCompare::Engine.new(opts)
.parse!
.equal?
```## TODO
- Evaluate shorthand properties, so the values of base properties get overridden.
- Evaluate @media rule's and @supports rule's conditions.
- Output the difference, optionally.## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/vecerek/css_compare.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).