-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sketch): add support for generating icon ranges (#5711)
* chore: check-in * fix(icons): update svg assets Each svg asset was rendering with an extra path which was causing the number to be "punched out" when we combined paths. This diff goes through and removes them from the corresponding svg assets. * fix(pictograms): update build script * feat(sketch): add support for generating icon ranges This patch adds support for building icons in the [32, 24] range and the [20, 16] range. In addition, it addresses some common icon rendering bugs by taking advantage of the new asset extension from `icon-build-helpers`. We now render icons in Sketch directly from the asset source instead of from the generated source. * docs(sketch): add JSDoc to shared icon commands * chore(sketch): add generated folder to clean task * chore(sketch): fix eslint violations * Update packages/sketch/src/commands/icons/sync.js * Update packages/sketch/src/commands/icons/sync.js * chore(icons,pictograms): update ci-check and scaffold scripts * fix(icons): update generate command to omit deprecated icons * fix(icons): update redo and undo to include background * fix(sketch): remove transparent layers from symbol artboard
- Loading branch information
Showing
29 changed files
with
407 additions
and
306 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
packages/icon-build-helpers/src/metadata/extensions/assets.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Copyright IBM Corp. 2020, 2020 | ||
* | ||
* This assets code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this assets tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
|
||
/** | ||
* Provide source and filepath asset information for a given icon | ||
* @type {Extension} | ||
*/ | ||
const assets = { | ||
name: 'assets', | ||
computed: true, | ||
extend(metadata, _data, registry, { input }) { | ||
for (const entry of metadata.icons) { | ||
const icon = registry.get(entry.name); | ||
entry.assets = icon.assets.map(({ size, filepath }) => { | ||
return { | ||
size, | ||
filepath: path.relative(input, filepath), | ||
source: fs.readFileSync(filepath, 'utf8'), | ||
}; | ||
}); | ||
} | ||
}, | ||
}; | ||
|
||
module.exports = assets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.sketchplugin | ||
generated |
Oops, something went wrong.