Created
July 21, 2020 16:00
-
-
Save christianklotz/58d54270049732f7b4ae0f52aa016758 to your computer and use it in GitHub Desktop.
Create Sketch Assistant using existing rules
This file contains hidden or 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
/** | |
Simple Assistant setting exactly one rule, limiting the number of layers that should be | |
allowed per group. The rule is provided by the Sketch Core Assistant. | |
1. Use Assistant Template from https://github.com/sketch-hq/sketch-assistant-template/ | |
2. Find and replace all `sketch-assistant-template` with `sketch-organisation-assistant` | |
3. Install dependencies and add Core Assistant | |
npm install | |
npm install --save @sketch-hq/sketch-core-assistant | |
4. Replace src/index.ts with this gist's content | |
5. Create Assistant package | |
npm run package-tarball | |
6. Test resulting `.tgz` with your Sketch document via Assistants window › Manage Assistants… › Add from Archive… | |
*/ | |
import { AssistantPackage } from '@sketch-hq/sketch-assistant-types' | |
import CoreAssistant from '@sketch-hq/sketch-core-assistant' | |
const assistant: AssistantPackage = [ | |
CoreAssistant, | |
async () => { | |
return { | |
name: 'sketch-organisation-assistant', | |
rules: [], | |
config: { | |
rules: { | |
'@sketch-hq/sketch-core-assistant/groups-max-layers': { | |
active: true, | |
maxLayers: 3, | |
skipClasses: ['artboard'], | |
}, | |
}, | |
}, | |
} | |
}, | |
] | |
export default assistant |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment