Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# .github/workflows/publish.yml

name: Publish
name: jsr-publish

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [ 18.x, 20.x, 22.x ]
node-version: [ 20.x, 22.x, 24.x ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/benchmark
/tools
/ROADMAP.md
/CHANGELOG.md
/rollup.config.js
/tsconfig.json
/src
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.1.0

- [x] inline sourcemap
- [x] CSS validation using mdn-data
- [x] prefix removal now remove prefixes from all nodes. prefixed linear gradients are not supported

# v1.0.0

- [x] current color parse error when used in color functions
Expand Down Expand Up @@ -114,7 +120,7 @@ error validation

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

Expand Down
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $ deno add @tbela99/css-parser
## Features

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

## Playground

Expand Down Expand Up @@ -95,7 +96,7 @@ Javascript module from cdn

<script type="module">

import {transform} from 'https://esm.sh/@tbela99/css-parser@1.0.0/web';
import {transform} from 'https://esm.sh/@tbela99/css-parser@1.1.0/web';


const css = `
Expand Down Expand Up @@ -165,11 +166,19 @@ Include ParseOptions and RenderOptions
in the :root {} or html {} rule.
- removeEmpty: boolean, optional. remove empty rule lists from the ast.

> CSS Prefix Removal Options

- removePrefix: boolean, optional. remove CSS prefixes.

> Validation Options

- validation: boolean, optional. enable strict css validation using (mdn data)[https://github.com/mdn/data]. only the
selector is validated at this time.
- lenient: boolean, optional. ignore unknown at-rules, pseudo-classes and declarations.
- validation: ValidationLevel | boolean, optional. enable validation. permitted values are:
- ValidationLevel.None: no validation
- ValidationLevel.Default: validate selectors and at-rules (default)
- ValidationLevel.All. validate all nodes
- true: same as ValidationLevel.All.
- false: same as ValidationLevel.None
- lenient: boolean, optional. preserve invalid tokens.

> Sourcemap Options

Expand Down Expand Up @@ -205,7 +214,7 @@ Include ParseOptions and RenderOptions

> Sourcemap Options

- sourcemap: boolean, optional. generate sourcemap
- sourcemap: boolean | 'inline', optional. generate sourcemap.

> Misc Options

Expand Down Expand Up @@ -706,7 +715,7 @@ for (const {node, parent, root} of walk(ast)) {

## Minification

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

```

---

Thanks to [Jetbrains](https://jetbrains.com) for sponsoring this project with a free license
Loading