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 98 forks source link

@media in @-moz-document #83

Open Gvozd opened 7 years ago

Gvozd commented 7 years ago

crash at parsing

var CSSOM = require('cssom');
var css;
try {
    css = CSSOM.parse(`
        @-moz-document url-prefix() {
            @media only screen{
                #main {
                    color:red;
                }
            }
        }   
    `);
    console.log(css);
}catch(e) {
/* Error
{ [Error: Unexpected } (line 8, char 3)]
  line: 8,
  char: 3,
  styleSheet: CSSStyleSheet { parentStyleSheet: null, cssRules: [ [Object] ] } }

*/
    console.log(e);
}

css = CSSOM.parse(`
    @-moz-document url-prefix() {
        #main {
            color:red;
        }
    }
    @media only screen{
        #main {
            color:red;
        }
    }
`);
console.log(css);// works
ameinhardt commented 5 years ago

Same problem when using mocka with Vuetify / VGrid. It produces

@-moz-document url-prefix() {
@media print {
    .v-content {
      display: block;
    }
}
}

I think vuetify uses Jest and removes CSS completely via Jest-CSS-Modules

danielschwartz85 commented 5 years ago

same here with: parse("@svg-load url(./some.svg){ .path{} }")