Skip to content

Commit 0df90e8

Browse files
authored
Merge pull request #86 from tbela99/feature/remove_prefix
inline sourcemap #82 css validation using mdn data #83 prefix removal #84
2 parents 987c303 + 93f3fdb commit 0df90e8

File tree

177 files changed

+78704
-9807
lines changed

Some content is hidden

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

177 files changed

+78704
-9807
lines changed

.github/workflows/jsr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# .github/workflows/publish.yml
22

3-
name: Publish
3+
name: jsr-publish
44

55
on:
66
push:

.github/workflows/node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
node-version: [ 18.x, 20.x, 22.x ]
20+
node-version: [ 20.x, 22.x, 24.x ]
2121
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2222

2323
steps:

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
/benchmark
77
/tools
88
/ROADMAP.md
9-
/CHANGELOG.md
109
/rollup.config.js
1110
/tsconfig.json
1211
/src

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v1.1.0
4+
5+
- [x] inline sourcemap
6+
- [x] CSS validation using mdn-data
7+
- [x] prefix removal now remove prefixes from all nodes. prefixed linear gradients are not supported
8+
39
# v1.0.0
410

511
- [x] current color parse error when used in color functions
@@ -114,7 +120,7 @@ error validation
114120

115121
- [x] render node with parents
116122
- [x] fix relative color from xyz
117-
- [x] fix bug when inlineCss is true bug no css variable exists
123+
- [x] fix bug when inlineCss is true but no css variable exists
118124
- [x] compute more shorthands
119125
- [x] (web) fetch imported css files from external domains using cors
120126

README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $ deno add @tbela99/css-parser
2323
## Features
2424

2525
- no dependency
26-
- partial css validation based upon mdn-data: at-rules and selectors validation
26+
- CSS validation based upon mdn-data
2727
- fault-tolerant parser, will try to fix invalid tokens according to the CSS syntax module 3 recommendations.
2828
- fast and efficient minification without unsafe transforms,
2929
see [benchmark](https://tbela99.github.io/css-parser/benchmark/index.html)
@@ -38,6 +38,7 @@ $ deno add @tbela99/css-parser
3838
- inline css variables
3939
- remove duplicate properties
4040
- flatten @import rules
41+
- experimental CSS prefix removal
4142

4243
## Playground
4344

@@ -95,7 +96,7 @@ Javascript module from cdn
9596

9697
<script type="module">
9798
98-
import {transform} from 'https://esm.sh/@tbela99/css-parser@1.0.0/web';
99+
import {transform} from 'https://esm.sh/@tbela99/css-parser@1.1.0/web';
99100
100101
101102
const css = `
@@ -165,11 +166,19 @@ Include ParseOptions and RenderOptions
165166
in the :root {} or html {} rule.
166167
- removeEmpty: boolean, optional. remove empty rule lists from the ast.
167168

169+
> CSS Prefix Removal Options
170+
171+
- removePrefix: boolean, optional. remove CSS prefixes.
172+
168173
> Validation Options
169174
170-
- validation: boolean, optional. enable strict css validation using (mdn data)[https://github.com/mdn/data]. only the
171-
selector is validated at this time.
172-
- lenient: boolean, optional. ignore unknown at-rules, pseudo-classes and declarations.
175+
- validation: ValidationLevel | boolean, optional. enable validation. permitted values are:
176+
- ValidationLevel.None: no validation
177+
- ValidationLevel.Default: validate selectors and at-rules (default)
178+
- ValidationLevel.All. validate all nodes
179+
- true: same as ValidationLevel.All.
180+
- false: same as ValidationLevel.None
181+
- lenient: boolean, optional. preserve invalid tokens.
173182

174183
> Sourcemap Options
175184
@@ -205,7 +214,7 @@ Include ParseOptions and RenderOptions
205214

206215
> Sourcemap Options
207216
208-
- sourcemap: boolean, optional. generate sourcemap
217+
- sourcemap: boolean | 'inline', optional. generate sourcemap.
209218

210219
> Misc Options
211220
@@ -706,7 +715,7 @@ for (const {node, parent, root} of walk(ast)) {
706715

707716
## Minification
708717

709-
- [x] minify keyframs
718+
- [x] minify keyframes
710719
- [x] minify transform
711720
- [x] evaluate math functions calc(), clamp(), min(), max(), round(), mod(), rem(), sin(), cos(), tan(), asin(),
712721
acos(), atan(), atan2(), pow(), sqrt(), hypot(), log(), exp(), abs(), sign()
@@ -1030,7 +1039,3 @@ console.debug(await transform(css, options));
10301039
// .foo{width:3px}
10311040

10321041
```
1033-
1034-
---
1035-
1036-
Thanks to [Jetbrains](https://jetbrains.com) for sponsoring this project with a free license

0 commit comments

Comments
 (0)