-
Notifications
You must be signed in to change notification settings - Fork 35
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
ignoreJSErrors true, yet puppeteer throws in some cases. #400
Comments
I'm confused. Those are two separate errors (one |
So, the first error, let options = {
urls: ['https://hostchefs.eu'],
enableServiceWorkers: false,
ignoreCSSErrors: true,
ignoreJSErrors: true,
ignoreRequestErrors: true,
puppeteerArgs: ['--no-sandbox'],
};
minimalcss
.minimize(options)
.then((result) => {
console.log(result.finalCss);
})
.catch((error) => {
console.log('Something wrong wrong');
console.error(error);
process.exit(1);
}); The full error is:
For the record, What's curious is A) why isn't |
Hey @peterbe, I share the same concerns. I also tried this against puppeteer 5.3 so I can use chromium 8x instead of 7x Thought I should open an issue in case you have seen something similar before. I will also ask for a css validation on the following: so that we have additional information what creates the issue. |
For the record, I dug into it a bit and concluded that:
|
Forgot to mention I have already tried this as well. |
I dumped all the CSS it downloads to a temp directory:
In .products-res{float:left;margin-right:55px width:50%} And I put some
So when theres a mention of Now, I wish we can turn this into a bug on |
By the way, there's something really wrong about that This happens. We (CSS files) all make mistakes. I just wish the error wasn't so cryptic. I'd love it if
Do you think you can take a look at that? In fact, this diff kinda solves your problem: diff --git a/src/run.js b/src/run.js
index 69ae7b0..1637585 100644
--- a/src/run.js
+++ b/src/run.js
@@ -115,6 +115,13 @@ const processStylesheet = ({
stylesheetContents,
}) => {
const ast = csstree.parse(text);
+ try {
+ csso.syntax.compress(ast);
+ console.log(`${responseUrl} WORKED!\n`);
+ } catch (ex) {
+ console.log(`${responseUrl} FAILED HORRIBLY!\n`, ex);
+ }
+
csstree.walk(ast, (node) => {
if (node.type !== 'Url') return;
const value = node.value; Obivously, that's not good enough for a fix. But might be a start. At least, equipped with something like this you'd get an insight where to put your attention ( Also, remember that you can potentially move this code down into the bottom of the file where you have an Object ( Perhaps something like |
##Expected Behavior
When ignoreJSErrors is
true
to get a minimal css result.Current Behavior
minimalcss throws an exception.
Steps/Code to Reproduce
The text was updated successfully, but these errors were encountered: