Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Could not parse CSS stylesheet #109

Open
nhidtran opened this issue Jan 2, 2021 · 4 comments
Open

Error: Could not parse CSS stylesheet #109

nhidtran opened this issue Jan 2, 2021 · 4 comments

Comments

@nhidtran
Copy link

nhidtran commented Jan 2, 2021

Screen Shot 2021-01-01 at 9 31 22 PM

cssom is installed with version "0.4.4"
and is a dependency for jsdom at ^0.4.4

Followed this thread when this was an issue at version 0.3.2 with no avail

@StJohn3D
Copy link

StJohn3D commented Nov 22, 2022

Same, it's breaking JSDOM for me too. Here is my CSS parsing error detail

detail: '\n' +
        '    @layer theme {\n' +
        '      :root {\n' +
        '        --theme-bodyBackgroundColor: #a85a5a;\n' +
        '        --theme-bodyTextColor: #a85a5a;\n' +
        '        --theme-buttonBackgroundColor: #a85a5a;\n' +
        '        --theme-buttonTextColor: #a85a5a;\n' +
        '        --theme-footerBackgroundColor: #a85a5a;\n' +
        '        --theme-footerTextColor: #a85a5a;\n' +
        '        --theme-headerBackgroundColor: #a85a5a;\n' +
        "        --theme-headerImage: 'TEST_HEADER_IMAGE_FILE_NAME.png';\n" +
        '        --theme-headerTextColor: #a85a5a;\n' +
        '      }\n' +
        '    }\n' +
        '    @layer overrides {\n' +
        '      nx-platform-shell {\n' +
        '        --header-bg-color-h: 0deg;\n' +
        '        --header-bg-color-s: 31%;\n' +
        '        --header-bg-color-l: 50.6%;\n' +
        '        --header-text-color: #a85a5a;\n' +
        '        --nav-toggle-icon-hover-color: #a85a5a;\n' +
        '      }\n' +
        '      nx-platform-menu-item {\n' +
        '        --active-bg-stop1-h: 0deg;\n' +
        '        --active-bg-stop1-s: 31%;\n' +
        '        --active-bg-stop1-l: 50.6%;\n' +
        '        --active-bg-stop2-h: 0deg;\n' +
        '        --active-bg-stop2-s: 31%;\n' +
        '        --active-bg-stop2-l: 50.6%;\n' +
        '        --icon-hover-color: #a85a5a;\n' +
        '      }\n' +
        '    }\n' +
        '  ',
      type: 'css parsing'

My guess is that my custom element names are breaking it.
Here are the version numbers I had when writing this comment.

jest-environment-jsdom: 29.3.1

jsdom: ^20.0.0

jsdom: 20.0.3

cssom: ^0.5.0

cssom: 0.5.0

@dr2009
Copy link

dr2009 commented Jan 20, 2023

cssom@0.5.0 not support @container ,@layer

@persocon
Copy link

cssom@0.5.0 not support @container ,@layer

will it ever support? or there's a version that does? 🤔 this bug basically exists pointing to CSSOM since 2017, kinda weird no? 🤔

@xylophonehero
Copy link

xylophonehero commented May 8, 2024

Anyone coming here from tailwind land, I ended up using cva package to ignore the container styles when in a jest environment

const component = cva('bg-blue-500', { 
  variants: { 
    isTestEnv: { false: '@md:bg-red-500' }
  },
  defaultVariants: {
    isTestEnv: typeof jest !== 'undefined',
  },
})

component()

I couldn't just suppress the error as I have tests which check if elements are hidden that require css parsing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants