iconic / grunt-svg-toolkit

A toolkit for working with, styling and converting SVG files.
MIT License
82 stars 10 forks source link

Use new phantom api #6

Open cgutierrez opened 8 years ago

cgutierrez commented 8 years ago

May or may not be of interest. I've updated the library to use the latest version of the Phantom API. This originally stemmed from receiving the following error:

Running "svgtoolkit:icons" (svgtoolkit) task
phantom stdout: NETWORK_ERR: XMLHttpRequest Exception 101: A network error occurred in synchronous requests.

phantom stdout:   phantomjs://code/shim.js:1815 in send
  phantomjs://code/shim.js:1815 in _start
  phantomjs://code/shim.js:1842

The fix for this was to set the --web-security=no flag.

tlatulimp commented 7 years ago

Thank you! After 2 days spent tearing my hair out (phantomjs < v2 not compatible with OSX Sierra) I ended up here and you saved the day!

pminf commented 7 years ago

Hey, any chance to merge this ticket? Phantomjs v1.x has not been updated since 2014-01-25 so we had to switch to version 2 in most environments.

alexan commented 6 years ago

why does this not get merged?

kjr247 commented 6 years ago

This is not my fix.

damien-murphy commented 6 years ago

This can be fixed by just passing '--web-security=no' to phantom.create() as the first param in init-phantomjs.js

https://github.com/iconic/grunt-svg-toolkit/blob/master/tasks/lib/init-phantomjs.js#L16

phantom.create('--web-security=no', function (ph) {
      data.logger('New PhantomJS instance created.');

      data.phantomjs = ph;
      done(null, data);
    }, {
      dnodeOpts: {
        weak: false
      }
    });