newsdev / ai2html

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

Folder with same .ai name #132

Closed garibaldig closed 4 years ago

garibaldig commented 4 years ago

Hello all,

Could be possible to have one single directory which has the same name as the .ai file?

The idea is to generate a folder through the script, but it should get the name from the .ai file and then export all .html and images inside that folder.

I hope that it makes sense.

Thank you so much for your help.

martgnz commented 4 years ago

Hey @garibaldig. I've implemented something similar in our fork. To make the change you'll have to download the ai2html script first and edit the file with a code editor. I think the following should work:

In line 458 you can add a check that resets the html_output_path setting with the document name:

So the following:

fonts = docSettings.fonts; // set global variable

if (!textBlockData.settings) {
  createSettingsBlock(docSettings);
}

Changes to this:

fonts = docSettings.fonts; // set global variable

// sets the output folder to the document name
docSettings.html_output_path = docName + "/"

if (!textBlockData.settings) {
  createSettingsBlock(docSettings);
}

After this the script should save into a folder named as the Illustrator file. Please let me know how it goes!

garibaldig commented 4 years ago

Hi @martgnz !

that is exactly what I was looking for, much appreciated your help!

garibaldig commented 4 years ago

@martgnz I have just another small question related with this, what about if I want to keep the name of the .html file as "index.html" ?

In this instance, I got that but it does not work now: htmlFileDestination = htmlFileDestinationFolder + 'index' + settings.html_output_extension;

Thank you so much

martgnz commented 4 years ago

Are you editing this line?

If I change it to what you have it works on my system, I get an index.html file.

htmlFileDestination = htmlFileDestinationFolder + 'index' + settings.html_output_extension;

If that doesn't work there are other ways to make the change, but they could affect other parts of the html so I wouldn't really recommend.

garibaldig commented 4 years ago

Looks like that is working now, I am not sure what was exactly the problem that I got yesterday.

However, I have tried to re-write that piece of code and is working now!

Thanks again for your support, much appreciated!