- 
                Notifications
    You must be signed in to change notification settings 
- Fork 163
Allow class name compilation on the basis of character styles (applied in Illustrator) #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
… style names applied in Illustrator as paragraph class names in the html output
| I just updated and tested this PR to work with the latest version of  These are the updates I've done: 
 These updates now support multiple character styles in a text field. As mentioned above Character Styles work really well in Illustrator. As spaces are allowed in Character Style names (and won't get "slugged"), it's also possible set multiple classes per paragraph range, i.e.:  | 
| Thanks for sharing this code I wasn't familiar with Character Styles -- we don't use them in our graphics department -- but I can see how they could be useful. I'm not going to accept this PR in it's current form. My main objection is that the "characterstyles_to_classnames" option doesn't capture all the relevant information about text style. In particular: 
 This PR has given me some ideas for improving ai2html's default CSS generation: 
 | 
From a perspective of updatability, it makes more sense to use class names referring to "external" style definitions and not being part of the ai2html output. Another benefit doing so is that the HTML output of a ai2html project will generate less CSS code if no more "project specific" paragraph definitions are needed in it.
At the moment, it's already possible to define custom class names for
divs containing text. Naming a layer that contains text in Illustrator results in adivwith a class name consisting of the "slugged" parent layer name and prefixed by thenameSpacevariable.However the class names generated for paragraph elements (wrapped into those
divs) are not customizable. Even if adiv's class name is customized, it's hard to access/overwrite paragraph style definitions likecolororfont-family. The reason for this are the generated style blocks making usage of selectors like#g-project-mobile .g-aiPstyle0. For that reason, it's nearly impossible to set paragraph style definitions likecolor,font-family,font-sizeorline-heightby custom classes.In this PR we propose the setting property
characterstyles_to_classnamesthat – if set toyes– will..div(instead ofnameSpace+ parent layer name)g-aiPstyle0)text-alignas inline style to the paragraph element (as the only text property not controlled by Character Styles)styletagCharacter Styles in Illustrator work really well. As spaces are allowed in Character Style names (which won't get "slugged"), it's also possible set multiple classes per text element, i.e.:
s-font-text s-font-text--strong