• Stars
    star
    286
  • Rank 144,690 (Top 3 %)
  • Language
    JavaScript
  • Created over 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A panel for Illustrator to easily export all layers

#Layer Exporter for Adobe Illustrator

image

Layer Exporter lets you automatically export Illustrator layers to SVG, JPG or PNG files, along with coordinates data and HTML CSS files, with a single click. Think of it as a modest equivalent of Photoshop Asset Generator for Illustrator, with full HTML & CSS export.

It's a free & open source extension panel for Adobe Illustrator CC, made with the creative cloud extensiblity helpers.

##Install

CC extensions can either be installed via the built-in Adobe Exchange Panel (preferred method), or via a ZXP package executed in Extension Manager CC (which you must install first via the Creative Cloud Desktop application).

Open Illustrator and choose Window > extensions > Adobe Echange to open the exchange panel, look for "Layer exporter" and you should find it directly.

image

Alternatively, you can download and install the current production ZXP (stable) or the development ZXP (use with caution) for use with Extension Manager CC from the bin folder.

##Exporting Images

This panel uses naming conventions to create the JPG, PNG or SVG files from your artwork. For instance, to export the content of your "Logo" layer, simply rename it to "Logo.png", and your Logo.png file will be created in your destination folder.

image

Once you click the Export button, it will parse both layers and individual art items contained in those layers. All layers or items suffixed with a supported image file format will be created, unless it was made invisible. However, please note that only top level layers will be used, as sub-layers will be ignored.

The Options panel will let you specify globally image format options such as JPG quality, or whether or not SVG should outline text. Contrary to Photoshop Generator, you cannot set those options for individual image files.

image

###Exporting Layers

If you have a big file with many layers, renaming all those layers can be somewhat tedious. To help you with that renaming step, you can use the Tools panel to automatically rename all your layers so that they get exported to the appropriate file format.

Choosing None will simply remove all suffixes from layer names

image

###Exporting art items

All art items (such as paths, texts and groups) inside layers can also be suffixed to be exported to image files, even if its parent layer has itself been renamed to be exported as an image file.

You can automatically set the destination format for the items you selected by clicking the appropriate button in the Tools panel.

You can also use the Move selected items options to automatically create top level layers from those items. Choose One Layer to gather all selected items to the same new Layer. Alternatively, choose Multiple Layers to create as many layers as the selected items, each being located in its own layer.

##Exporting composition data

If you want to use exported image files somewhere (say, in a webpage or a native app), chances are you're going to need to get the coordinates of those elements in order to recreate the original composition.

There several options to help you with that.

###Exporting to HTML (static)

If you want to export your whole composition to HTML, choose the corresponding option to generate an HTML file in the parent folder of destination folder for the images.

You can choose to have CSS styles declared inside a <style> tag in the <head> of this HTML page, or to create a separate CSS file.

Layer Exporter will then use HTML tags to describe the composition, starting with a top level div named after the Illustrator file. Inside this div, all exported Layers will be converted to img tags.

Any layer that is not suffixed with a supported image file will be considered as a child div of the main div. All art items inside this layer suffixed with a supported image file format will be considered as a child img tag of the parent div.

image

Here's what a typical HTML output could look like (go to the samples folder for more details).

image

###Exporting to HTML (dynamic)

Alternatively, if you don't want to statically generate HTML and CSS code, you can choose to interpret the JSON file at runtime using javascript. You'll find sample code to help you do that in the utils folder of this repo, and a sample lanscape project in the samples folder.

###Experimental HTML features

We're working on some additional features to help with HTML export. Since those features are experimental, they are likely to change in the future. Also, things will break.

  • Text: text items suffixed with =text will be converted to full HTML text with the corresponding CSS styles (font family, font size, color and alignment).
  • Div backgrounds: inside layers, path items named "#bgd" will be ignored but used to determine the background color and opacity of the parent div.

For a full example of all those features, you can jump to the samples folder.

###Edge Animate project

Layer Exporter has (limited) support for Adobe's Edge Animate Projects.

Since Edge Animate supports HTML as input, you could simply open it inside the tool, but you'd then be missing a few capabilities, such as the ability to group or create symbol.

The Import to Edge Animate option lets you choose an existing .an file and will overwrite it with the corresponding data. A typical workflow would then consist of first creating a empty .an project, importing the illustrator composition via the Import to Edge Animate option, and then updating artwork as needed from Illustrator.

You'll find an empty Edge Animate project in the utils folder.

###Exporting to other contexts

Alternatively, you can choose to create a dump of the raw data of the composition so that you, a developer, or a 3rd party tool can interpret the data . Choose the Create JSON data file to create a JSON representation of the composition inside the image destination folder.

image

##Release notes

v 2.1.0 - May 28th 2014

  • Added HTML doctype
  • Art items are now correctly ignored from export if invisible
  • All invisible items are now correctly ignored from HTML output
  • Added css locations options for SVG
  • Added support for Illustrator next

V 2.0.1 - April 7th 2014

WARNING: this release has major functional differences with previous builds. You may have to reorganize your art to conform to the new model.

  • You can now also separately export art items inside layers. By default, layers are no longer exported as images and are treated as divs in HTML. Sub layers are not supported.
  • Art items named "#bgd" inside layers are ignored but used to set the background color & opacity of the parent div.
  • Elements suffixed with "=text" inside layers are exported as text and converted to <p> tags in HTML.
  • Option to generate separate CSS files for HTML export
  • Option to generate the data.json file
  • New Helper tools to automate layer and items suffixes

V 1.5.0 - March 11th 2014

  • Generate HTML pages including all generated assets (including CSS)
  • Import to Edge Animate
  • New Helper tools to create layers from path items
  • New UI based on topcoat (Regression: host theme support is removed in this build)
  • Bug Fixes

V 1.0 - June 2013

  • Generate JPG, PNG & SVG via layer names
  • Options to define the quality of JPG and SVG text handling
  • data.json file describes the scene graph for 3rd party tools

##Known issues

  • Sublayers are not supported. Rationale: a recursive process could be used, but an Illustrator bug prevents from knowing the relative zorder of layers vs art items, making it impossible to create a proper representation of the whole composition.
  • Special items (divs backgrounds and texts) are not currently supported in edge animate export
  • Layer names cannot be set with the same UX as with art items (eg "set selected layers as PNG"). Rationale: the illustrator API does not let us know which layers are selected.

##FAQ

###Why do I need Illustrator CC / 17.0+? Sorry, CC apps have a new engine for extensions which lets you create panels using nothing but web standards. This is what this panel uses. You can still port it by yourself, of course.

###How can I convert my rectangles to simple divs?

Because it would be stupid to use image files for simple rectangles when you could use div, you can simply use a non-suffixed layer with a rectangle inside. Using the (experimental) background element feature, this layer will be converted to a div and the underlying rectangle will be use to set the CSS for the size and the color.

###Can I inline SVG code in HTML rather than use img?

Unfortunately, no. Illustrator's API does not expose the generated SVG code, it only allows to automate file export.

###Hey, the exported SVG code sucks! While it does the job, the Illustrator SVG export engine is not so great in the first place. I highly recommend using SVGO for optimization.

###Why doesn't it work with my appearances? Sorry, appearances are not supported at this stage.

###Does it support symbols? Yes and no. Symbols instances will all be treated as separated image files.

###What about sublayers? Not supported, amigos.

##About the source code

This repository is the source for the panel. The underlying logic, written in ExtendScript, is located in the CSscript repository.

##Special thanks to

More Repositories

1

SVG-NOW

SVG Optimizer for Adobe Illustrator
JavaScript
306
star
2

CC-Extension-Builder-for-Brackets

A brackets Extension for building Creative Cloud extensions
JavaScript
94
star
3

CC-Extension-Builder-for-Sublime-Text

Sublime plugin for creating HTML panels in Photoshop and other Creative Cloud apps
Python
69
star
4

CSscripts

Scripts for Photoshop, Illustrator, and other Adobe Creative tools
JavaScript
69
star
5

CC-EXT-SDK

Unofficial SDK for building HTML based extensions for Adobe Creative Cloud applications
JavaScript
67
star
6

createjs-utils

Utilities I use for createJS development
JavaScript
67
star
7

Lita

Adobe AIR based SQLite administration (discontinued project)
ActionScript
54
star
8

ccext-boilerplate

No longer maintained (now merged with CC SDK)
JavaScript
34
star
9

Brackets-extension-toolkit

An extension to learn how to build extensions
JavaScript
25
star
10

sample-cc-extensions

A collection of HTML based extensions for creative cloud applications
JavaScript
25
star
11

prefixr-extension

Simple prefixr extension for brackets
JavaScript
18
star
12

annotate-extension

Brackets extension to generate JSDoc annotations
JavaScript
18
star
13

after2css

JavaScript
15
star
14

Edge-Animate-for-developers

An technical introduction to Edge Animate for web developers
JavaScript
13
star
15

tabtospace-extension

Brackets extension to switch tabs to spaces
JavaScript
10
star
16

appcache-gen

application cache generator extension for brackets
JavaScript
8
star
17

lupo-studio

A collection of utilities for flex app i18n
ActionScript
6
star
18

togist

simple brackets extension to create a gist from selection
JavaScript
5
star
19

brackets-architecture-article

An overview of Brackets code architecture
5
star
20

brackets-buildsys

A stupid simple build system for Brackets
JavaScript
3
star
21

require-test

Simple CRUD app using requirejs
JavaScript
2
star
22

Before-Going-Vector

Assets for the Adobe MAX Session What You Should Know Before Going Vector
JavaScript
2
star
23

AILayerExporterPage

Web Page for the Illustrator Layer Exporter
2
star
24

GitTest

simple test
ActionScript
1
star
25

createjs-rpg

A simple RPG battle engine made with createJS for demo purposes
JavaScript
1
star
26

try_git

1
star
27

createJS-intro

JavaScript
1
star
28

ccext-website

Simple webpage from presenting CC extensibility tools
1
star
29

require-test-bb

backbone tests
JavaScript
1
star
30

doc-gen

Brackets extension to generate documentation
JavaScript
1
star
31

davidderaedt

About me
1
star