Skip to content

Instantly share code, notes, and snippets.

@konstantindenerz
Last active July 23, 2024 11:52
Show Gist options
  • Save konstantindenerz/c4a7160ab4aff4605e18f116a3214fb4 to your computer and use it in GitHub Desktop.
Save konstantindenerz/c4a7160ab4aff4605e18f116a3214fb4 to your computer and use it in GitHub Desktop.
A WebStorm live template to generate a Storybook's stories file for a specific Angular component. Component Story Format V2
import {Meta, moduleMetadata, StoryObj} from '@storybook/angular';
import {$ComponentName$Component} from './$componentName$.component';
const meta: Meta<$ComponentName$Component> = {
title: '$StoryName$',
component: $ComponentName$Component,
};
export default meta;
type Story = StoryObj<$ComponentName$Component>;
export const Default: Story = {
args: {$END$}
};
@konstantindenerz
Copy link
Author

konstantindenerz commented Mar 4, 2021

How to add live template: https://www.jetbrains.com/help/webstorm/creating-and-editing-live-templates.html

The template above requires this list of variables:

Edit Template Variables

Name Expression Default value Skip if defined
ComponentName "Foobar"
componentName lowercaseAndDash(ComponentName)
StoryName ""

Bind the template to TypeScript files (context)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment