Server IP : 92.205.26.207 / Your IP : 216.73.216.16 Web Server : Apache System : Linux 207.26.205.92.host.secureserver.net 4.18.0-553.60.1.el8_10.x86_64 #1 SMP Thu Jul 10 04:01:16 EDT 2025 x86_64 User : zikryat ( 1002) PHP Version : 8.3.23 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/zikryat/public_html/node_modules/.bin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
#!/usr/bin/env node var juice = require('..'); var cli = require('../lib/cli'); var fs = require('fs'); var path = require('path'); var program = cli.getProgram(); if (program.args.length < 2) { program.help(); } var [inputFile, outputFile] = program.args; var options = cli.argsToOptions(program); var queue = []; if (options.optionsFile) { var optionsFromFile = require(path.resolve(process.cwd(),options.optionsFile)); options = Object.assign({}, optionsFromFile, options, { webResources: Object.assign( {}, optionsFromFile && optionsFromFile.webResources, options && options.webResources ) }); } if (options.cssFile) { queue.push(function() { fs.readFile(options.cssFile, function(err, css) { if (handleError(err)) { return; } options.extraCss = css.toString(); next(); }); }); } next(); function doJuice() { delete options.cssFile; delete options.optionsFile; juice.juiceFile(inputFile, options, function(err, html) { if (handleError(err)) { return; } fs.writeFile(outputFile, html, handleError); }); } function next() { if (queue.length) { return queue.pop()(); } doJuice(); } function handleError(err) { if (err) { console.error(err.stack); process.exit(1); } return !!err; }