Skip to content

Commit ee05057

Browse files
committed
add css module mapping
2 parents aca7822 + 7bd39b6 commit ee05057

File tree

258 files changed

+5285
-5966
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+5285
-5966
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,45 @@ console.debug(render(result.ast.chi[0].chi[1].chi[1], {withParents: true}));
365365

366366
```
367367

368+
### CSS Modules
369+
370+
CSS modules features are fully supported. refer to the [CSS modules](https://tbela99.github.io/css-parser/docs/documents/Guide.CSS_modules.html) documentation for more information.
371+
372+
```javascript
373+
import {transform} from '@tbela99/css-parser';
374+
375+
const css = `
376+
.table {
377+
border-collapse: collapse;
378+
width: 100%;
379+
}
380+
381+
.table td, .table th {
382+
border: 1px solid #ddd;
383+
padding: 8px;
384+
}
385+
386+
.table tr:nth-child(even){background-color: #f2f2f2;}
387+
388+
.table tr:hover {background-color: #ddd;}
389+
390+
.table th {
391+
padding-top: 12px;
392+
padding-bottom: 12px;
393+
text-align: left;
394+
background-color: #4CAF50;
395+
color: white;
396+
}
397+
`;
398+
399+
const result = await transform(css, {module: true});
400+
401+
// css code
402+
console.log(result.code);
403+
// css mapping
404+
console.log(result.mapping);
405+
```
406+
368407
### Convert colors
369408

370409
```javascript

dist/index-umd-web.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19291,8 +19291,6 @@
1929119291
val: tokens.slice(offset)
1929219292
});
1929319293
delete node.tokens;
19294-
// @ts-ignore
19295-
delete node.raw;
1929619294
context.chi.push(node);
1929719295
return null;
1929819296
}

dist/index.cjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19494,8 +19494,6 @@ function parseNode(results, context, options, errors, src, map, rawTokens, stats
1949419494
val: tokens.slice(offset)
1949519495
});
1949619496
delete node.tokens;
19497-
// @ts-ignore
19498-
delete node.raw;
1949919497
context.chi.push(node);
1950019498
return null;
1950119499
}

dist/lib/parser/parse.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,8 +1452,6 @@ function parseNode(results, context, options, errors, src, map, rawTokens, stats
14521452
val: tokens.slice(offset)
14531453
});
14541454
delete node.tokens;
1455-
// @ts-ignore
1456-
delete node.raw;
14571455
context.chi.push(node);
14581456
return null;
14591457
}

docs/.nojekyll

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/assets/hierarchy.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/assets/highlight.css

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,28 @@
2727
--dark-hl-12: #6A9955;
2828
--light-hl-13: #267F99;
2929
--dark-hl-13: #4EC9B0;
30-
--light-hl-14: #098658;
31-
--dark-hl-14: #B5CEA8;
32-
--light-hl-15: #800000;
33-
--dark-hl-15: #D7BA7D;
30+
--light-hl-14: #800000;
31+
--dark-hl-14: #D7BA7D;
32+
--light-hl-15: #0451A5;
33+
--dark-hl-15: #CE9178;
3434
--light-hl-16: #0451A5;
35-
--dark-hl-16: #CE9178;
36-
--light-hl-17: #CD3131;
37-
--dark-hl-17: #F44747;
38-
--light-hl-18: #811F3F;
39-
--dark-hl-18: #D16969;
40-
--light-hl-19: #D16969;
41-
--dark-hl-19: #CE9178;
42-
--light-hl-20: #000000;
43-
--dark-hl-20: #D7BA7D;
44-
--light-hl-21: #EE0000;
45-
--dark-hl-21: #D7BA7D;
46-
--light-hl-22: #EE0000;
47-
--dark-hl-22: #DCDCAA;
48-
--light-hl-23: #0451A5;
49-
--dark-hl-23: #9CDCFE;
50-
--light-hl-24: #000000;
51-
--dark-hl-24: #C8C8C8;
35+
--dark-hl-16: #9CDCFE;
36+
--light-hl-17: #000000;
37+
--dark-hl-17: #C8C8C8;
38+
--light-hl-18: #098658;
39+
--dark-hl-18: #B5CEA8;
40+
--light-hl-19: #CD3131;
41+
--dark-hl-19: #F44747;
42+
--light-hl-20: #811F3F;
43+
--dark-hl-20: #D16969;
44+
--light-hl-21: #D16969;
45+
--dark-hl-21: #CE9178;
46+
--light-hl-22: #000000;
47+
--dark-hl-22: #D7BA7D;
48+
--light-hl-23: #EE0000;
49+
--dark-hl-23: #D7BA7D;
50+
--light-hl-24: #EE0000;
51+
--dark-hl-24: #DCDCAA;
5252
--light-code-background: #FFFFFF;
5353
--dark-code-background: #1E1E1E;
5454
}

docs/assets/icons.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)