remy / inliner

Node utility to inline images, CSS and JavaScript for a web page - useful for mobile sites
MIT License
1.1k stars 165 forks source link

need a way to specify output file #188

Open clarkevans opened 5 years ago

clarkevans commented 5 years ago

Currently, the inliner script writes to stdout. I'm not sure what the exact issue is, but it wouldn't work on GitLab's CI service, the file would be created but would be zero length when using > redirection. Anyway, it was easy enough to write a simple script that works, hard coding paths. It'd also be helpful to have default size that is a bit bigger, large SVG files don't get inlined by default. Thank you so much.

#!/usr/bin/env node                                                     
var inliner = require("inliner");
var fs = require("fs");

new inliner("build/index.html", {size : 1024* 1024 }, 
  function(err, text) {
    if(err) {
       console.log(err);
       process.exit(1);
    }
    fs.writeFile("demo.html", text, 
      function(err) {
        if(err) {
           console.log(err);
           process.exit(1);
        }
    });
  });
clarkevans commented 5 years ago

Hmm. This may not be the core issue. Perhaps it's that inliner.js expects that it is outputting to a terminal? see inliner/cli/progress.js

wifiuk commented 1 year ago

+1 needs a -o FILENAME.html option

an-dr-eas-k commented 1 year ago

The core issue is here: https://github.com/remy/inliner/blob/df3619f89b5b4b76bd1b1bca675a58b38bf7a5b7/cli/options.js#L55