Skip to content

Commit 409229a

Browse files
author
emilien.escalle
committed
Initialize project
1 parent b4c587f commit 409229a

File tree

16 files changed

+14332
-2
lines changed

16 files changed

+14332
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/nbproject/
2+
/vendor/

.travis.composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"config":{
3+
"github-oauth":{
4+
"github.com":"069388e2ed1ad02978a005938ec140fe57edc15d"
5+
}
6+
}
7+
}

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# CONTRIBUTING
2+
3+
## RUNNING TESTS
4+
5+
To run tests:
6+
7+
- Make sure you have a recent version of PHPUnit installed; 4.8.0
8+
minimally.
9+
- Enter the `tests/` subdirectory.
10+
- Execute PHPUnit
11+
12+
```sh
13+
% phpunit
14+
```
15+
16+
- You may also provide the `--coverage-html` switch;
17+
18+
```sh
19+
% phpunit --coverage-html ./_report
20+
```
21+
22+
This will generate code-coverage report witch can be displayed in a browser by opening `tests/_report/index.html` file
23+

README.md

Lines changed: 173 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,173 @@
1-
# php-css-lint
2-
CSS Linter for PHP
1+
# Php CSS Lint
2+
3+
[![Build Status](https://travis-ci.org/neilime/ansi-escapes-to-html.svg?branch=master)](https://travis-ci.org/neilime/ansi-escapes-to-html)
4+
[![Latest Stable Version](https://poser.pugx.org/neilime/ansi-escapes-to-html/v/stable.svg)](https://packagist.org/packages/neilime/ansi-escapes-to-html)
5+
[![Total Downloads](https://poser.pugx.org/neilime/ansi-escapes-to-html/downloads.svg)](https://packagist.org/packages/neilime/ansi-escapes-to-html)
6+
[![Coverage Status](https://coveralls.io/repos/github/neilime/ansi-escapes-to-html/badge.svg?branch=master)](https://coveralls.io/github/neilime/ansi-escapes-to-html?branch=master)
7+
8+
_Php CSS Lint_ is a php script that lint css files and strings :
9+
10+
```bash
11+
===========================================================
12+
13+
____ _ ____ ____ ____ _ _ _
14+
| _ \| |__ _ __ / ___/ ___/ ___| | | (_)_ __ | |_
15+
| |_) | '_ \| '_ \ | | \___ \___ \ | | | | '_ \| __|
16+
| __/| | | | |_) | | |___ ___) |__) | | |___| | | | | |_
17+
|_| |_| |_| .__/ \____|____/____/ |_____|_|_| |_|\__|
18+
|_|
19+
20+
===========================================================
21+
22+
# Lint file "/path/to/css/file.css"...
23+
=> File "/path/to/css/file.css" is not valid :
24+
25+
- Unknown CSS property "bordr-top-style" (line: 8, char: 20)
26+
- Unexpected char ":" (line: 15, char: 5)
27+
```
28+
29+
# Helping Project
30+
31+
If this project helps you reduce time to develop and/or you want to help the maintainer of this project, you can make a donation, thank you.
32+
<a href='https://pledgie.com/campaigns/33252'><img alt='Click here to lend your support to: php-css-lint and make a donation at pledgie.com !' src='https://pledgie.com/campaigns/33252.png?skin_name=chrome' border='0' ></a>
33+
34+
# Contributing
35+
36+
If you wish to contribute to this project, please read the [CONTRIBUTING.md](CONTRIBUTING.md) file.
37+
NOTE : If you want to contribute don't hesitate, I'll review any PR.
38+
39+
# Requirements
40+
41+
Name | Version
42+
-----|--------
43+
[php](https://secure.php.net/) | >=5.3.3
44+
45+
# Installation
46+
47+
## Main Setup
48+
49+
### With composer (the faster way)
50+
51+
1. Add this project in your composer.json:
52+
53+
```json
54+
"require": {
55+
"neilime/php-css-lint": "1.*@stable"
56+
}
57+
```
58+
59+
2. Now tell composer to download __ANSI escapes to Html__ by running the command:
60+
61+
```bash
62+
$ php composer.phar update
63+
```
64+
65+
### By cloning project (manual)
66+
67+
1. Clone this project into your `./vendor/` directory.
68+
69+
# Usage
70+
71+
## As a bin script
72+
73+
### Display man page
74+
75+
In a terminal, execute :
76+
```bash
77+
bin/php-css-lint
78+
```
79+
80+
Result :
81+
```bash
82+
===========================================================
83+
84+
____ _ ____ ____ ____ _ _ _
85+
| _ \| |__ _ __ / ___/ ___/ ___| | | (_)_ __ | |_
86+
| |_) | '_ \| '_ \ | | \___ \___ \ | | | | '_ \| __|
87+
| __/| | | | |_) | | |___ ___) |__) | | |___| | | | | |_
88+
|_| |_| |_| .__/ \____|____/____/ |_____|_|_| |_|\__|
89+
|_|
90+
91+
===========================================================
92+
93+
Usage :
94+
------------------------------------------------------------
95+
Lint a CSS file :
96+
scripts/php-css-lint css_file_path_to_lint.css
97+
------------------------------------------------------------
98+
```
99+
100+
### Lint a file
101+
102+
In a terminal, execute :
103+
```bash
104+
bin/php-css-lint /path/to/css/file.css
105+
```
106+
107+
Result :
108+
```bash
109+
===========================================================
110+
111+
____ _ ____ ____ ____ _ _ _
112+
| _ \| |__ _ __ / ___/ ___/ ___| | | (_)_ __ | |_
113+
| |_) | '_ \| '_ \ | | \___ \___ \ | | | | '_ \| __|
114+
| __/| | | | |_) | | |___ ___) |__) | | |___| | | | | |_
115+
|_| |_| |_| .__/ \____|____/____/ |_____|_|_| |_|\__|
116+
|_|
117+
118+
===========================================================
119+
120+
# Lint file "/path/to/css/file.css"...
121+
=> File "/path/to/css/file.css" is not valid :
122+
123+
- Unknown CSS property "bordr-top-style" (line: 8, char: 20)
124+
- Unexpected char ":" (line: 15, char: 5)
125+
```
126+
127+
## In a php script
128+
129+
### Composer autoloading
130+
131+
```php
132+
// Composer autoloading
133+
if (!file_exists($sComposerAutoloadPath = __DIR__ . '/vendor/autoload.php')) {
134+
throw new \RuntimeException('Composer autoload file "' . $sComposerAutoloadPath . '" does not exist');
135+
}
136+
if (false === (include $sComposerAutoloadPath)) {
137+
throw new \RuntimeException('An error occured while including composer autoload file "' . $sComposerAutoloadPath . '"');
138+
}
139+
```
140+
141+
### Initialize Css Linter
142+
143+
```php
144+
$cssLinter = new \CssLint\Linter();
145+
```
146+
147+
### Lint string
148+
149+
```php
150+
if($cssLinter->lintString('
151+
.button.drodown::after {
152+
display: block;
153+
width: 0;
154+
}') === true){
155+
echo 'Valid!';
156+
}
157+
else {
158+
echo 'Not Valid :(';
159+
var_dump($cssLinter->getErrors());
160+
}
161+
```
162+
163+
### Lint file
164+
165+
```php
166+
if($cssLinter->lintFile('path/to/css/file.css') === true){
167+
echo 'Valid!';
168+
}
169+
else {
170+
echo 'Not Valid :(';
171+
var_dump($cssLinter->getErrors());
172+
}
173+
```

composer.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "neilime/php-css-lint",
3+
"type": "library",
4+
"description": "Powerfull & memory efficiant CSS linter for PHP",
5+
"keywords": ["CSS", "lint", "linter", "syntax", "validation"],
6+
"homepage": "http://neilime.github.io/php-css-lint/",
7+
"license": "MIT",
8+
"authors": [
9+
{
10+
"name": "Neilime",
11+
"homepage": "https://github.com/neilime",
12+
"role": "Developer"
13+
}
14+
],
15+
"support": {
16+
"issues": "https://github.com/neilime/php-css-lint/issues"
17+
},
18+
"minimum-stability": "stable",
19+
"autoload": {
20+
"psr-4": {
21+
"CssLint\\": "src/CssLint"
22+
}
23+
},
24+
"autoload-dev": {
25+
"psr-4": {
26+
"TestSuite\\": "tests/TestSuite"
27+
}
28+
},
29+
"require": {
30+
"php": ">=5.3.3"
31+
},
32+
"require-dev": {
33+
"phpunit/phpunit": "4.*.*",
34+
"satooshi/php-coveralls": "1.*.*"
35+
},
36+
"bin": [
37+
"scripts/php-css-lint"
38+
]
39+
}

0 commit comments

Comments
 (0)