newsdev / ai2html

A script for Adobe Illustrator that converts your Illustrator artwork into an html page.
http://ai2html.org
Other
895 stars 143 forks source link

Wrap everything in a <html> line #133

Closed garibaldig closed 4 years ago

garibaldig commented 4 years ago

Hi all, I was trying to move around the order of things when exporting the .html file.

The idea is to have this order here:

1. <html>
2. <all the generated code by the script>
3. </html>

Thank you so much

martgnz commented 4 years ago

It could be an option in the settings too. Did you manage to do it? As a reference I added the tags between these lines:

if (scriptEnvironment == 'nyt-preview') {
  commentBlock += '<!-- preview: ' + settings.preview_slug + ' -->\r';
}
if (settings.scoop_slug_from_config_yml) {
  commentBlock += '<!-- scoop: ' + settings.scoop_slug_from_config_yml + ' -->\r';
}

// add html tags
commentBlock += '<html lang="en">\r';
commentBlock += '<head>\r';
commentBlock += '\t<meta charset="utf-8">\r';
commentBlock += '\t<meta name="viewport" content="width=device-width">\r';
commentBlock += '</head>\r';
commentBlock += '<body>\r';

// HTML
html = '<div id="' + containerId + '" class="ai2html">\r';

And then I replaced the textForFile declaration with this:

textForFile =  '\r' + commentBlock + css + '\r' + html + '\r' + js +
"</body>\r" +
"</html>\r" +
"<!-- End ai2html" + " - " + getDateTimeStamp() + " -->\r";
garibaldig commented 4 years ago

Fantastic @martgnz !

Thank you so much again for your help, much appreciated it!