VS Code Task to Create an Aurelia Component
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
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
// Create a registry.ts file in the root of your modules folder | |
// Position in the registry.ts file before running the task | |
"detail": "Create the TS, HTML and CSS files for a component", | |
"label": "au2 create component", | |
"type": "shell", | |
"dependsOrder": "sequence", | |
"dependsOn": [ | |
"create folder", | |
"create ts file", | |
"create html file", | |
"create css file", | |
"append to registry" | |
], | |
"presentation": { | |
"reveal": "silent", | |
"panel": "shared" | |
}, | |
"args": ["${input:componentName}"] | |
}, | |
{ | |
"label": "create folder", | |
"type": "shell", | |
"command": "If (!(Test-Path ${fileDirname}\\components\\${input:componentName})){md ${fileDirname}\\components\\${input:componentName}}" | |
}, | |
{ | |
"label": "create ts file", | |
"type": "shell", | |
"command": "'export class ' + ((Get-Culture).TextInfo.ToTitleCase(('${input:componentName}'.ToLower() -replace '-', ' ')) -replace ' ', '') + '{}' | Out-File -FilePath ${fileDirname}\\components\\${input:componentName}\\${input:componentName}.ts -NoClobber" | |
}, | |
{ | |
"label": "create html file", | |
"type": "shell", | |
"command": "'<div class=\"' + '${input:componentName}'.ToLower() + '\">\r\n${input:componentName}\r\n</div>' | Out-File -FilePath ${fileDirname}\\components\\${input:componentName}\\${input:componentName}.html -NoClobber" | |
}, | |
{ | |
"label": "create css file", | |
"type": "shell", | |
"command": "'.' + '${input:componentName}'.ToLower() + '{\r\n width: 100%; \r\n}' | Out-File -FilePath ${fileDirname}\\components\\${input:componentName}\\${input:componentName}.css -NoClobber" | |
}, | |
{ | |
"label": "append to registry", | |
"type": "shell", | |
"command": "'export * from \\\"./components/' + '${input:componentName}/${input:componentName}\\\";' | Out-File -FilePath ${file} -Append -NoClobber" | |
} | |
], | |
"inputs": [ | |
{ | |
"id": "componentName", | |
"description": "Name your component", | |
"default": "new-component", | |
"type": "promptString" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment