main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
619 bytes
|
Line | |
---|
1 | var Token = require('../../tokenizer/token');
|
---|
2 |
|
---|
3 | var serializeAll = require('../../writer/one-time').all;
|
---|
4 |
|
---|
5 | var FONT_FACE_SCOPE = '@font-face';
|
---|
6 |
|
---|
7 | function removeDuplicateFontAtRules(tokens) {
|
---|
8 | var fontAtRules = [];
|
---|
9 | var token;
|
---|
10 | var key;
|
---|
11 | var i, l;
|
---|
12 |
|
---|
13 | for (i = 0, l = tokens.length; i < l; i++) {
|
---|
14 | token = tokens[i];
|
---|
15 |
|
---|
16 | if (token[0] != Token.AT_RULE_BLOCK && token[1][0][1] != FONT_FACE_SCOPE) {
|
---|
17 | continue;
|
---|
18 | }
|
---|
19 |
|
---|
20 | key = serializeAll([token]);
|
---|
21 |
|
---|
22 | if (fontAtRules.indexOf(key) > -1) {
|
---|
23 | token[2] = [];
|
---|
24 | } else {
|
---|
25 | fontAtRules.push(key);
|
---|
26 | }
|
---|
27 | }
|
---|
28 | }
|
---|
29 |
|
---|
30 | module.exports = removeDuplicateFontAtRules;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.