Skip to content

Instantly share code, notes, and snippets.

@benjamincharity
Created June 28, 2017 18:18
Show Gist options
  • Save benjamincharity/c84889479c3b4502c68ad9cf2ea255d0 to your computer and use it in GitHub Desktop.
Save benjamincharity/c84889479c3b4502c68ad9cf2ea255d0 to your computer and use it in GitHub Desktop.
Change the casing of a snippet variable.
# Module
# NOTE: The last line lowercases the first letter of the 1st variable and stores it as the 2nd
# variable
snippet uim "Create a UI module" m
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
/*
*import {
* MdButtonModule,
*} from '@angular/material';
*/
import { Ts${1:Foo}Component } from './$2.component';
export { Ts$1Component } from './$2.component';
@NgModule({
imports: [
CommonModule,
],
exports: [
Ts$1Component,
],
declarations: [
Ts$1Component,
],
})
export class Ts$1Module {}
`!p t[2] = t[1][:1].lower() + t[1][1:]`
endsnippet
# Component
# NOTE: The last line uppercases the first letter of the 2nd variable and stores it as the 3rd
# variable
snippet uic "Create a UI component" m
import {
Component,
Input,
Output,
} from '@angular/core';
/**
* ${1:This is...}
*
* @example
* <ts-${2:foo}
* item="Value"
* ></ts-$2>
*/
@Component({
selector: 'ts-$2',
templateUrl: './$2.component.html',
styleUrls: ['./$2.component.scss'],
})
export class Ts$3Component {
/**
* TODO
*/
/**
* @Input() itemName: type = 'Value';
*/
}
`!p t[3] = t[2][:1].upper() + t[2][1:]`
endsnippet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment