cornet icon indicating copy to clipboard operation
cornet copied to clipboard

Question: A simple trumped equivalent example

Open Kikobeats opened this issue 6 years ago • 0 comments

Hello, thanks for write this library, it's small and easy to use.

Can you provide a trumpet example equivalent in order to modify a specific matched selector and write the output?

var trumpet = require('trumpet');
var tr = trumpet();
tr.pipe(process.stdout);
 
var ws = tr.select('tbody').createWriteStream();
ws.end('<tr><td>rawr</td></tr>');

var fs = require('fs');
fs.createReadStream(__dirname + '/html/table.html').pipe(tr);

Particularly, in my case, I want to rewrite some things from an original HTML, like convert image src into absolute URLs.

Kikobeats avatar Jun 21 '18 10:06 Kikobeats