-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmultiple-stylesheets.js
More file actions
37 lines (28 loc) · 1015 Bytes
/
Copy pathmultiple-stylesheets.js
File metadata and controls
37 lines (28 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* @file rule: multiple-stylesheets
* @author Oleg Krivtsov <oleg@webmarketingroi.com.au>
*/
module.exports = {
name: 'multiple-stylesheets',
desc: 'More than one style-sheet is included (combining all style-sheets into one neat CSS file would be cleaner)',
target: 'parser',
lint: function (getCfg, parser, reporter) {
var stylesheetCount = 0;
parser.on('opentag', function (name, attrs) {
if (!getCfg()) {
return;
}
if (name === 'link' && attrs.rel === 'stylesheet') {
if (stylesheetCount === 1) {
reporter.warn(
this.startIndex,
'028',
'More than one style-sheet is included (combining '
+ 'all style-sheets into one neat CSS file would be cleaner)'
);
}
stylesheetCount++;
}
});
}
};