This is a CSS lint tool built as a Microverse Ruby capstone project.
- Ruby (Version 2.7.0)
- Colorize gem
- RSpec gem
- GitFlow
This linter promotes best CSS practices by checking for:
- Unwanted trailing spaces at the end of lines in a file.
- Indentation of 2 spaces at the beginning of lines where necessary.
- Empty line at the end of the file.
- Spaces before opening curly braces.
- Missing semi-colon at the end of lines where necessary.
Click here in order to see a Live Demo of this project.
- Terminal/Command Prompt.
- CSS stylesheets to run linter on.
To get a local copy up and running follow these simple example steps.
-
Download repository files.
-
Open up a terminal session.
-
In your terminal, change directory into the
css-censor/bin
folder. -
Run
ln -s $PWD/censor /usr/local/bin
in your terminal and then runcensor
+ file to be checked. Eg:censor main.css
. -
If the above does not work, just run
./censor
+ file to be checked in your terminal. Eg:./censor main.css
. -
Alternatively, you can quickly test this linter by running
censor lib/good_test.css
and/orcensor lib/bad_test.css
. -
If you happen to be in the bin folder, run
./censor ../lib/good_test.css
and/or./censor ../lib/bad_test.css
. -
If all else fails,
ruby bin/censor lib/good_test.css
will do the trick! 😉
Here is an example of good code with correct usage of syntax, spaces and indentation.
.section {
height: 2rem;
width: 1rem;
}
Here is an example of poorly written code with incorrect usage of syntax, spaces and indentation.
.section{
height: 2rem
width: 1rem;}
👤 Christopher Amanor
- Github: @krys2fa
- Twitter: @krys2fa
- Linkedin: Christopher Amanor
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
This project is MIT licensed.