|
6 | 6 | [](https://packagist.org/packages/neilime/php-css-lint)
|
7 | 7 | [](https://beerpay.io/neilime/php-css-lint)
|
8 | 8 |
|
9 |
| -Introduction |
10 |
| ------------- |
11 |
| - |
12 |
| -_Php CSS Lint_ is a php script that lint css files and strings : |
| 9 | +__Php CSS Lint__ is a php script that lint css files and strings : |
13 | 10 |
|
14 | 11 | ```
|
15 | 12 | ===========================================================
|
@@ -38,164 +35,3 @@ _Php CSS Lint_ is a php script that lint css files and strings :
|
38 | 35 |
|
39 | 36 | If you wish to contribute to this project, please read the [CONTRIBUTING.md](CONTRIBUTING.md) file.
|
40 | 37 | NOTE : If you want to contribute don't hesitate, I'll review any PR.
|
41 |
| - |
42 |
| -# Requirements |
43 |
| - |
44 |
| -Name | Version |
45 |
| ------|-------- |
46 |
| -[php](https://secure.php.net/) | ^7.2 |
47 |
| - |
48 |
| - |
49 |
| -# [Code coverage](https://coveralls.io/github/neilime/php-css-lint) |
50 |
| - |
51 |
| -# [PHP Doc](https://neilime.github.io/php-css-lint/phpdoc) |
52 |
| - |
53 |
| -# Installation |
54 |
| - |
55 |
| -## With composer (the faster way) |
56 |
| - |
57 |
| -```bash |
58 |
| -$ php composer.phar install neilime/php-css-lint |
59 |
| -``` |
60 |
| - |
61 |
| -# Usage |
62 |
| - |
63 |
| -## As a bin script |
64 |
| - |
65 |
| -### Display man page |
66 |
| - |
67 |
| -In a terminal, execute : |
68 |
| - |
69 |
| -```bash |
70 |
| -$ php vendor/bin/php-css-lint |
71 |
| -``` |
72 |
| - |
73 |
| -Result : |
74 |
| - |
75 |
| -``` |
76 |
| -=========================================================== |
77 |
| -
|
78 |
| - ____ _ ____ ____ ____ _ _ _ |
79 |
| - | _ \| |__ _ __ / ___/ ___/ ___| | | (_)_ __ | |_ |
80 |
| - | |_) | '_ \| '_ \ | | \___ \___ \ | | | | '_ \| __| |
81 |
| - | __/| | | | |_) | | |___ ___) |__) | | |___| | | | | |_ |
82 |
| - |_| |_| |_| .__/ \____|____/____/ |_____|_|_| |_|\__| |
83 |
| - |_| |
84 |
| -
|
85 |
| -=========================================================== |
86 |
| -
|
87 |
| -Usage : |
88 |
| ------------------------------------------------------------- |
89 |
| -Lint a CSS file : |
90 |
| -bin/php-css-lint css_file_path_to_lint.css |
91 |
| -
|
92 |
| -Lint a CSS string : |
93 |
| -scripts/php-css-lint ".test { color: red; }" |
94 |
| ------------------------------------------------------------- |
95 |
| -``` |
96 |
| - |
97 |
| -### Lint a file |
98 |
| - |
99 |
| -In a terminal, execute : |
100 |
| - |
101 |
| -```bash |
102 |
| -$ bin/php-css-lint /path/to/css/file.css |
103 |
| -``` |
104 |
| - |
105 |
| -Result : |
106 |
| - |
107 |
| -``` |
108 |
| -=========================================================== |
109 |
| -
|
110 |
| - ____ _ ____ ____ ____ _ _ _ |
111 |
| - | _ \| |__ _ __ / ___/ ___/ ___| | | (_)_ __ | |_ |
112 |
| - | |_) | '_ \| '_ \ | | \___ \___ \ | | | | '_ \| __| |
113 |
| - | __/| | | | |_) | | |___ ___) |__) | | |___| | | | | |_ |
114 |
| - |_| |_| |_| .__/ \____|____/____/ |_____|_|_| |_|\__| |
115 |
| - |_| |
116 |
| -
|
117 |
| -=========================================================== |
118 |
| -
|
119 |
| -# Lint file "/path/to/css/file.css"... |
120 |
| - => File "/path/to/css/file.css" is not valid : |
121 |
| -
|
122 |
| - - Unknown CSS property "bordr-top-style" (line: 8, char: 20) |
123 |
| - - Unexpected char ":" (line: 15, char: 5) |
124 |
| -``` |
125 |
| - |
126 |
| -### Lint a css string |
127 |
| - |
128 |
| -In a terminal, execute : |
129 |
| - |
130 |
| -```bash |
131 |
| -$ bin/php-css-lint ".test { color: red; fail }" |
132 |
| -``` |
133 |
| - |
134 |
| -Result : |
135 |
| - |
136 |
| -``` |
137 |
| -=========================================================== |
138 |
| -
|
139 |
| - ____ _ ____ ____ ____ _ _ _ |
140 |
| - | _ \| |__ _ __ / ___/ ___/ ___| | | (_)_ __ | |_ |
141 |
| - | |_) | '_ \| '_ \ | | \___ \___ \ | | | | '_ \| __| |
142 |
| - | __/| | | | |_) | | |___ ___) |__) | | |___| | | | | |_ |
143 |
| - |_| |_| |_| .__/ \____|____/____/ |_____|_|_| |_|\__| |
144 |
| - |_| |
145 |
| -
|
146 |
| -=========================================================== |
147 |
| -
|
148 |
| -# Lint css string... |
149 |
| - => Css string is not valid : |
150 |
| -
|
151 |
| - - Unexpected property name token "}" (line: 1, char: 26) |
152 |
| - - Unterminated "property name" (line: 1, char: 26) |
153 |
| -``` |
154 |
| - |
155 |
| -## In a php script |
156 |
| - |
157 |
| -### Composer autoloading |
158 |
| - |
159 |
| -```php |
160 |
| -// Composer autoloading |
161 |
| -if (!file_exists($sComposerAutoloadPath = __DIR__ . '/vendor/autoload.php')) { |
162 |
| - throw new \RuntimeException('Composer autoload file "' . $sComposerAutoloadPath . '" does not exist'); |
163 |
| -} |
164 |
| -if (false === (include $sComposerAutoloadPath)) { |
165 |
| - throw new \RuntimeException('An error occured while including composer autoload file "' . $sComposerAutoloadPath . '"'); |
166 |
| -} |
167 |
| -``` |
168 |
| - |
169 |
| -### Initialize Css Linter |
170 |
| - |
171 |
| -```php |
172 |
| -$cssLinter = new \CssLint\Linter(); |
173 |
| -``` |
174 |
| - |
175 |
| -### Lint string |
176 |
| - |
177 |
| -```php |
178 |
| -if($cssLinter->lintString(' |
179 |
| -.button.drodown::after { |
180 |
| - display: block; |
181 |
| - width: 0; |
182 |
| -}') === true){ |
183 |
| - echo 'Valid!'; |
184 |
| -} |
185 |
| -else { |
186 |
| - echo 'Not Valid :('; |
187 |
| - var_dump($cssLinter->getErrors()); |
188 |
| -} |
189 |
| -``` |
190 |
| - |
191 |
| -### Lint file |
192 |
| - |
193 |
| -```php |
194 |
| -if($cssLinter->lintFile('path/to/css/file.css') === true){ |
195 |
| - echo 'Valid!'; |
196 |
| -} |
197 |
| -else { |
198 |
| - echo 'Not Valid :('; |
199 |
| - var_dump($cssLinter->getErrors()); |
200 |
| -} |
201 |
| -``` |
0 commit comments