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

nested @page in @media causes errors #78

Open
ryleyb opened this issue Sep 14, 2018 · 3 comments
Open

nested @page in @media causes errors #78

ryleyb opened this issue Sep 14, 2018 · 3 comments

Comments

@ryleyb
Copy link

ryleyb commented Sep 14, 2018

const inlineCSS = require('inline-css');

var input =
`<style>
  @media print {
    @page {
      .root-element {
        size: a3;
      }
    }
  }
</style>
<div class="root-element">
    Test Page
</div>`;

inlineCSS(input,{url:' '}).then(function(html) {
    console.log(html);
}).catch(function(error) {
    console.error(error);
});

Output:

Error: Error: Unexpected } (line 8, char 3)
    at module.exports (/Users/ryleyb/src/vue/node_modules/inline-css/lib/inline-css.js:69:15)
    at /Users/ryleyb/src/vue/node_modules/inline-css/lib/inlineContent.js:25:27
    at /Users/ryleyb/src/vue/node_modules/extract-css/index.js:39:16
    at /Users/ryleyb/src/vue/node_modules/batch/index.js:161:14
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:611:11)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:578:3

I don't need or expect any particular result of trying to inline this CSS. Just not an error. On my actual page, ignoring the @page would be fine.

@mrbubbaz
Copy link

same problem with @supports feature query.
here is my code (taken from bootstrap4):

@supports (transform-style: preserve-3d) {
  .carousel-item-next,
  .active.carousel-item-right {
    transform: translate3d(100%, 0, 0);
  }
}

output:

Unhandled rejection Error: Error: Unexpected } (line 5630, char 1)
    at module.exports (/Users/simonefranchina/Documents/works/htdocs/inp/node_modules/inline-css/lib/inline-css.js:69:15)
    at /Users/simonefranchina/Documents/works/htdocs/inp/node_modules/inline-css/lib/inlineContent.js:25:27
    at /Users/simonefranchina/Documents/works/htdocs/inp/node_modules/extract-css/index.js:39:16
    at /Users/simonefranchina/Documents/works/htdocs/inp/node_modules/extract-css/node_modules/batch/index.js:161:14
    at process._tickCallback (internal/process/next_tick.js:150:11)

@xinglinb
Copy link

@supports 的问题解决了吗

@clizSec
Copy link

clizSec commented Apr 19, 2020

Happens to me too.
Error: Unexpected } (line 166, char 2)\n at module.exports (/app/node_modules/inline-css/lib/inline-css.js:65:15)\n at /app/node_modules/inline-css/lib/inlineContent.js:22:27\n at /app/node_modules/extract-css/index.js:37:16

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

4 participants