Optimize SVG transform
Adobe-Export-Scripts
Adobe-Export-Scripts-master > Illustrator > Export Layout.jsx
- Edit SVG file for Adobe Illustrator.
- Export SVG position and size data, and save SVG.
- Run this script.
Grouped just under one layer.
Example
Layer 1
|- <Line>
|- <Rect>
|- <Path>
To Group
Layer 1
|- <Group>
|- <Group>
|- <Group>
And change group name. If it is the same name, add _
and specify a sequential number.
Example
Layer 1
|- line
|- circle_1
|- circle_2
|- rect_1
|- rect_2
Can change the transform-origin
by setting after *
. If not set it will become the center of the group.
- Specified in order of
x
,y
with percentage at the upper left origin. Example:50,50
. - To specify it from the parent SVG, add
^
to the prefix. Example:^50,50
.
Example
Layer 1
|- line
|- circle_1*0,100
|- circle_2*20,80
|- rect_1*^0,100
|- rect_2*^50,50
group name | target | x | y |
---|---|---|---|
line | self group | 50 | 50 |
circle_1 | self group | 0 | 100 |
circle_2 | self group | 20 | 80 |
rect_1 | parent SVG | 0 | 100 |
rect_2 | parent SVG | 50 | 50 |
Run Adobe Illustrator script Export Layout.jsx
, and save SVG.
Move svg file and text file to src
directory.
src
|- [name].svg
|- [name].txt
Run optimize-svg-transform script.
$ npm run optimize -- [name]
Output to dist
directory.
dist
|- [name].html
value: string useInline
or inline
dafault: useInline
value: string
dafault: src
value: string
dafault: dist
value: string
dafault: html
value: string
dafault: svg
value: string
dafault: svg-
value: string
dafault: empty
id name and class name.
value: string
dafault: empty
data attribute key.
value: string class
or id
dafault: class
data attribute value type.