Skip to content

Commit eea264a

Browse files
committed
Merge pull request #8 from lydell/update-image
Update the example image
2 parents 52a4e23 + 130d125 commit eea264a

File tree

4 files changed

+13
-32
lines changed

4 files changed

+13
-32
lines changed

example.png

-2.28 KB
Loading

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"devDependencies": {
2626
"eslint": "0.20.0",
2727
"lodash": "3.8.0",
28+
"postcss-bem-linter": "0.3.0",
2829
"tape": "4.0.0"
2930
},
3031
"dependencies": {

test/forVisual.css

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
body {
1+
/** @define HamSandwich */
2+
.Ham.Sandwich {
23
color: pink;
34
}
45

5-
div {
6-
color: orange;
7-
background: blue;
8-
}
9-
10-
p {
11-
color: yellow;
6+
:root a {
7+
font-weight: bold;
128
}

test/visual.js

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,21 @@
11
'use strict';
22

33
var postcss = require('postcss');
4+
var bemLinter = require('postcss-bem-linter');
45
var logWarnings = require('..');
56
var fs = require('fs');
67

7-
var rejectColors = postcss.plugin('reject-colors', function() {
8-
return function(css, result) {
9-
css.eachDecl(function(decl) {
10-
if (decl.prop === 'color') {
11-
result.warn('no colors allowed', { node: decl });
12-
}
13-
});
14-
};
15-
});
16-
17-
var rejectBackgrounds = postcss.plugin('reject-backgrounds', function() {
18-
return function(css, result) {
19-
css.eachDecl(function(decl) {
20-
if (decl.prop === 'background') {
21-
result.warn('no backgrounds allowed', { node: decl });
22-
}
23-
});
24-
};
25-
});
26-
27-
fs.readFile('test/forVisual.css', { encoding: 'utf8' }, function(err, data) {
28-
if (err) throw err;
8+
fs.readFile('test/forVisual.css', { encoding: 'utf8' }, function(readErr, data) {
9+
if (readErr) throw readErr;
2910
postcss()
30-
.use(rejectColors())
31-
.use(rejectBackgrounds())
11+
.use(bemLinter())
3212
.use(logWarnings({ throwError: true }))
3313
.process(data, { from: 'test/forVisual.css' })
3414
.then(function() {
15+
console.error('`throwError: true` failed!');
16+
})
17+
.catch(function(ourErr) {
18+
console.log(ourErr);
3519
console.log('There\'s your visual confirmation that it works.');
3620
});
3721
});

0 commit comments

Comments
 (0)