uncss: Phantomjs crashing when trying to process 100+ links
Hi Gents,
I want to scan all the pages in my website to identify unused css, but when I add 100 links to files array phantom js crashes with strange error
PhantomJS has crashed. Please read the crash reporting guide at https://github.com/ariya/phantomjs/wiki/Crash-Reporting and file a bug report at https://github.com/ariya/phantomjs/issues/new with the crash dump file attached: /tmp/8ECEAFDC-2355-4665-8293-BF732DEF5F40.dmp
I am using standard implementation
var uncss = require('uncss');
var files = ['http://example.com/page1.html',
'http://example.com/page2.html',
......
'98 more links'],
options = {
stylesheets: [
'http://example.com/css/style.css'
],
timeout: 20000,
report: true
};
uncss(files, options, function (error, output, report) {
console.log(output);
});
I have already tried setting high ulimit -n 5120, but his didn’t help either.
Is there a way to pass an argument to uncss or phantomjs to process only one link at a time and when done only then move on to 2nd link?
or use promises to chain multiple uncss functions?
I have over 1000+ links that I would like to scan, I don’t see this happening unless phantomjs can be sent some argument from uncss to limit number of concurrent urls to process.
Thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 22 (9 by maintainers)
FWIW, I am not yet convinced that there is an issue with inline JS. (No one’s presented a small use case. And in fact, it could even be possible that external relative-to-page external JS is failing to load silently, and that the erors only become visible when it’s forced to run/load as part of running inline.)
However, I do fully agree that the JS errors are harmless unless the error-ing code would otherwise be adding CSS classes to elements.
@saalmaan , I am confused. Let me know if this is correct:
Except that July 3rd and August 5th should essentially be the same code except for a few minor testing/reporting-related changes. So I’m unclear why you are seeing different results…am I missing anything here?
@RyanZim here is the list of urls http://pastebin.com/BJ5Z9uaL
and css files that needs cleaning
http://currys.cdn.dixons.com/css/style.cssI am debugging it now with node-debug
I just pushed some changes to my personal Uncss repo that limit the PhantomJS reuse to 10 pages. @saalmaan , please give it a shot and let me know if it fixes your issues? https://github.com/mikelambert/uncss