Reputation: 897
Suppose I have a number of compiled HTML-files from Harp, the static site generator.
My question:
How do I post-process multiple HTML files, in each, automatically copying the contents of < h1> tag to the < title> tag?
I'm wondering, if Gulp would be right for the job (and if so, how?), or if, perhaps, Sublime Text 3 would have such feature built-in?
Upvotes: 0
Views: 243
Reputation: 1339
hmm...well you can use gulp or grunt or any other build tool to do that.
You can also use some other text find-and-replace tools like sed.
if you need more stuff to do on your files (packging, post-processing, move, rename, ...) it makes sense to use gulp/grunt.
If you ended up using gulp/grunt you need to define a task which reads the content of those files and then does the replace and write to file. (a bit of nodejs knowledge is required + javascript basics)
Upvotes: 0
Reputation: 3478
How about doing it dynamically onpage load?
var newtext = $("h1").text();
$("title").text(newtext);
Upvotes: -1