Last active
July 5, 2017 13:41
-
-
Save wizardforcel/9ec348fcafef21434bc271f6b5358b01 to your computer and use it in GitHub Desktop.
split a html file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
try {fs.mkdirSync('out');} | |
catch(ex){} | |
var co = fs.readFileSync('out.html', 'utf-8'); | |
var files = co.split(/<!\-\-split\-\->/g); | |
//var summary = ''; | |
//var pre = "{% raw %}\n", | |
// sub = "\n{% endraw %}"; | |
for(var i = 0; i < files.length; i++) | |
{ | |
fs.writeFileSync('out/' + i + '.html', files[i], {encoding: 'utf-8'}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment