Skip to content

Commit

Permalink
fix(playground): update template generator to support Angular standal…
Browse files Browse the repository at this point in the history
…one (#3983)
  • Loading branch information
brandyscarney authored Dec 31, 2024
1 parent af0d981 commit f8949c0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 34 deletions.
7 changes: 0 additions & 7 deletions _templates/playground/new/angular.md.ejs.t

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
to: "<%= `static/usage/v${version}/${name}/${path}/angular/example_component_html.md` %>"
---
```html
<<%= component %>></<%= component %>>
```
11 changes: 5 additions & 6 deletions _templates/playground/new/angular_example_component_ts.md.ejs.t
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
---
# this file only gets generated if `angular_ts` (from the command line prompt) is true
to: "<%= angular_ts ? `static/usage/v${version}/${name}/${path}/angular/example_component_ts.md` : null %>"
arbitrary: <% pascalComponent = h.changeCase.pascal(component) %>
to: "<%= `static/usage/v${version}/${name}/${path}/angular/example_component_ts.md` %>"
---
```ts
import { Component } from '@angular/core';
import { <%= pascalComponent %> } from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
<% if (css){ -%>
styleUrls: ['./example.component.css'],
<% } -%>
imports: [<%= pascalComponent %>],
})
export class ExampleComponent {
}
export class ExampleComponent {}
```
5 changes: 0 additions & 5 deletions _templates/playground/new/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ module.exports = {
name: 'css',
message: 'Generate custom CSS files?',
},
{
type: 'toggle',
name: 'angular_ts',
message: 'Generate an Angular TypeScript file?',
},
])
.then((answers) => {
answers.name = answers.name || answers.component.replace('ion-', '');
Expand Down
17 changes: 3 additions & 14 deletions _templates/playground/new/index.md.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@ import react_main_css from './react/main_css.md';
import react from './react.md';
<% } -%>
import vue from './vue.md';
<% if (css || angular_ts){ %>

import angular_example_component_html from './angular/example_component_html.md';
<% } else { -%>
import angular from './angular.md';
<% } -%>
<% if (angular_ts){ -%>
import angular_example_component_ts from './angular/example_component_ts.md';
<% } -%>
<% if (css){ -%>
import angular_example_component_css from './angular/example_component_css.md';
<% } -%>
import angular_example_component_ts from './angular/example_component_ts.md';

<Playground
version="<%= version %>"
Expand All @@ -39,21 +34,15 @@ import angular_example_component_css from './angular/example_component_css.md';
react,
<% } -%>
vue,
<% if (angular_ts || css){ -%>
angular: {
files: {
'src/app/example.component.html': angular_example_component_html,
<% if (angular_ts){ -%>
'src/app/example.component.ts': angular_example_component_ts,
<% } -%>
<% if (css){ -%>
'src/app/example.component.css': angular_example_component_css,
<% } -%>
'src/app/example.component.ts': angular_example_component_ts,
},
},
<% } else { -%>
angular,
<% } -%>
}}
src="usage/v<%= version %>/<%= name %>/<%= path %>/demo.html"
/>
5 changes: 3 additions & 2 deletions _templates/playground/new/react.md.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import './main.css';<% } %>

function Example() {
return (
<<%= pascalComponent %>></<%= pascalComponent %>>
<>
<<%= pascalComponent %>></<%= pascalComponent %>>
</>
);
}
export default Example;
```

0 comments on commit f8949c0

Please sign in to comment.