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

Allow HMR as a dependency access phantomjs #214

Open
clintandrewhall opened this issue Aug 24, 2018 · 1 comment
Open

Allow HMR as a dependency access phantomjs #214

clintandrewhall opened this issue Aug 24, 2018 · 1 comment

Comments

@clintandrewhall
Copy link

I'm using HackMyResume as a dependency in my own website, building the output as my site is deployed. Since it's Heroku, I can't guarantee wkthmltopdf, phantomjs, etc are installed.

I can use phantomjs-prebuilt, so I edited html-pdf-cli-generator to check if phantomjs-prebuilt was installed, and used it instead:

    let pathToBin = 'phantomjs';

    // If the executable was installed in the node_modules directory of a
    // project, and that project includes wkhtmltopdf, use that instance
    // instead.
    try {
      const installed = detectInstalled.sync('phantomjs-prebuilt', {
        cwd: process.cwd(),
        local: true,
      });
      if (installed) {
        pathToBin = PATH.join(process.cwd(), 'node_modules', '.bin', 'phantomjs');
      }
    } catch (e) {
      return false;
    }

    SPAWN(pathToBin, [ scriptPath, sourcePath, destPath ], false, on_error, this);

Any thoughts on this approach, before I submit a PR?

@eloiqs
Copy link

eloiqs commented Dec 18, 2019

I came accross the same use case deploying my site to Netlify. I have no control over the build environment and need to generate a pdf.

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

2 participants