NV / CSSOM

Unmaintained! ⚠️ CSS Object Model implemented in pure JavaScript. Also, a CSS parser.
https://nv.github.io/CSSOM/docs/parse.html
MIT License
751 stars 99 forks source link

parse: Unexpected } (line 1, char 43385) #92

Closed mikegleasonjr closed 6 years ago

mikegleasonjr commented 6 years ago

Here's a test case with a js and a css file:

test.zip

Basically the js is:

const cssom = require('cssom');
const fs = require('fs');

fs.readFile('test.css', 'utf8', (err, contents) => {
    console.log(cssom.parse(contents));
});

Run with node test.js.

thomashigginbotham commented 6 years ago

The issue is that your CSS contains an @supports rule. I had the same problem and created a fix for it. I retested on your CSS, and it works fine.

NV commented 6 years ago

@mikegleasonjr this should be fixed in cssom v0.3.4. Please verify.