bholloway / resolve-url-loader

Webpack loader that resolves relative paths in url() statements based on the original source file
563 stars 71 forks source link

[Bug] @page css properties widths generating warnings #39

Closed luchillo17 closed 5 years ago

luchillo17 commented 7 years ago

Using the following styles for printing in any css generates warnings, most likely because of the size units being mm, in or cm:

@page {
    width:44mm;
    size:8.5in 11in; 
    margin: 0.5cm !important;
};

Warning:

image

gcarothers commented 7 years ago

I think it's a bit worse than that. I'm pretty sure rework is just barfing on any page block :(

    WARNING in ./~/css-loader?{"importLoaders":3,"minimize":false,"sourceMap":true}!./~/postcss-loader!./~/resolve-url-loader!./~/sass-loader?{"sourceMap":true}!./sass/export.scss
      resolve-url-loader cannot operate: CSS error
      /home/gavin/LexMachina/src/deus_lex/winslow/sass/export.scss:14375:3: @page missing '}'
      at error (/home/gavin/LexMachina/src/deus_lex/winslow/node_modules/resolve-url-loader/node_modules/rework/node_modules/css/lib/parse/index.js:62:15)
luchillo17 commented 7 years ago

Interesting, in my case it just stop showing the warning if i leave the @page block empty, i'll check Thursday again.

gcarothers commented 7 years ago

Yes, but that's 'cause uh, @pages handing inside of rework is badly broken. :( Starting a fork to see if this is fixable tomorrow.

gcarothers commented 7 years ago

https://github.com/reworkcss/css/blob/master/lib/parse/index.js#L413-L437 The defined expected syntax is just wrong

gcarothers commented 7 years ago

@Luchillo Ah, I think your error is the trailing ; after } for @page mine was a bit more fun.

https://github.com/reworkcss/css/pull/105

luchillo17 commented 7 years ago

@gcarothers I've tested again, it is indeed the @page rule, i tough it was the units of size because when i deleted the content it worked fine, but i failed to realize that it worked probably because the sass-loader was ignoring empty rule sets.

bholloway commented 7 years ago

~@Luchillo~ @gcarothers Let me know if your reworkcss MR is ever merged.

It looks like that project is stale, long term I think we will end up replacing reworkcss with something else.

bholloway commented 5 years ago

Finally replaced rework with postcss.

Please refer to #97 as version 3 may help any open issues.

bholloway commented 5 years ago

I'm going to close this ageing issue because we have a new version 3.0.0 which (e2e testing confirms) is much better.

Please open a fresh issue for any ongoing problems and link to this one as needed.

I'm not opposed to reopening this issue but certainly lets talk with respect to the new version.