Skip to content

Commit

Permalink
Merge pull request #17 from makamekm/develop
Browse files Browse the repository at this point in the history
Midnight fixes
  • Loading branch information
makamekm authored Feb 29, 2020
2 parents f610519 + d01e93d commit ee980eb
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm_notify_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Node.js Public Release Notes
on:
release:
types:
- created
- published

jobs:
test_develop:
Expand Down
16 changes: 11 additions & 5 deletions content.plugins.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { emptyChildren, getComponentName, createComponent, getDescriptionStyles, saveSvgToDisk } = require('./lib');
const svgtojsx = require('svg-to-jsx');

const contentPlugins = [
applyStyles,
Expand Down Expand Up @@ -57,7 +58,7 @@ function renderMask(state) {

async function renderVector(state, shared) {
const { vectors, genClassName, additionalStyles } = shared;
const { node, content } = state;
const { node, props, content } = state;
if (node.type === 'VECTOR' && vectors[node.id] && !node.isMask) {
emptyChildren(state);

Expand Down Expand Up @@ -86,10 +87,15 @@ async function renderVector(state, shared) {
additionalStyles.push(additionalSvgStyles);
}

const fileName = node.id.replace(/\W+/g, '-');
const url = await saveSvgToDisk(fileName, vectors[node.id], shared);

content.push(`<img className='vector ${currentClass}' src='${url}' />`);
if (Object.keys(props).includes('vectorImg')) {
const fileName = node.id.replace(/\W+/g, '-');
const url = await saveSvgToDisk(fileName, vectors[node.id], shared);
content.push(`<img className='vector ${currentClass}' src='${url}' />`);
} else {
let svg = await svgtojsx(vectors[node.id]);
svg = svg.replace('<svg', `<svg className='vector ${currentClass}'`);
content.push(svg);
}
}
}

Expand Down
231 changes: 228 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "figma-react",
"description": "This is a tool to help you export Figma project into React mockups",
"version": "1.0.12",
"version": "1.0.15",
"private": false,
"author": "Maxim Karpov <[email protected]>",
"repository": {
Expand Down Expand Up @@ -46,7 +46,8 @@
"dotenv": "^8.2.0",
"node-fetch": "^2.6.0",
"prettier": "^1.19.1",
"request-image-size": "^2.1.0"
"request-image-size": "^2.1.0",
"svg-to-jsx": "^1.0.2"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
Expand Down
Loading

0 comments on commit ee980eb

Please sign in to comment.