Skip to content

Commit b7348bd

Browse files
authored
fix(generation): correct angular imports (#3034)
* Refactor: Improve readability * Combine index files and fix bug with angular ts generation
1 parent 03a8153 commit b7348bd

File tree

5 files changed

+62
-46
lines changed

5 files changed

+62
-46
lines changed

_templates/playground/new/angular_example_component_ts.md.ejs.t

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import { Component } from '@angular/core';
77

88
@Component({
99
selector: 'app-example',
10-
templateUrl: 'example.component.html',<% if (css){ %>
11-
styleUrls: ['./example.component.css'],<% } %>
10+
templateUrl: 'example.component.html',
11+
<% if (css){ -%>
12+
styleUrls: ['./example.component.css'],
13+
<% } -%>
1214
})
1315
export class ExampleComponent {
1416
}
Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,60 @@
11
---
22
arbitrary: <% nameWithoutIon = name.replace('ion-', '') %>
3-
# this template is only used if `css` (from the command line prompt) is false
4-
to: "<%= css ? null : `static/usage/v${version}/${nameWithoutIon}/${path}/index.md` %>"
3+
to: "<%= `static/usage/v${version}/${nameWithoutIon}/${path}/index.md` %>"
54
---
65
import Playground from '@site/src/components/global/Playground';
76

87
import javascript from './javascript.md';
8+
<% if (css){ %>
9+
import react_main_tsx from './react/main_tsx.md';
10+
import react_main_css from './react/main_css.md';
11+
12+
<% } else { -%>
913
import react from './react.md';
14+
<% } -%>
1015
import vue from './vue.md';
16+
<% if (css || angular_ts){ %>
17+
import angular_example_component_html from './angular/example_component_html.md';
18+
<% } else { -%>
1119
import angular from './angular.md';
20+
<% } -%>
21+
<% if (angular_ts){ -%>
22+
import angular_example_component_ts from './angular/example_component_ts.md';
23+
<% } -%>
24+
<% if (css){ -%>
25+
import angular_example_component_css from './angular/example_component_css.md';
26+
<% } -%>
1227

13-
<Playground version="<%= version %>" code={{ javascript, react, vue, angular }} src="<%= `usage/v${version}/${nameWithoutIon}/${path}/demo.html` %>" />
28+
<Playground
29+
version="<%= version %>"
30+
code={{
31+
javascript,
32+
<% if (css){ -%>
33+
react: {
34+
files: {
35+
'src/main.tsx': react_main_tsx,
36+
'src/main.css': react_main_css,
37+
},
38+
},
39+
<% } else { -%>
40+
react,
41+
<% } -%>
42+
vue,
43+
<% if (angular_ts || css){ -%>
44+
angular: {
45+
files: {
46+
'src/app/example.component.html': angular_example_component_html,
47+
<% if (angular_ts){ -%>
48+
'src/app/example.component.ts': angular_example_component_ts,
49+
<% } -%>
50+
<% if (css){ -%>
51+
'src/app/example.component.css': angular_example_component_css,
52+
<% } -%>
53+
},
54+
},
55+
<% } else { -%>
56+
angular,
57+
<% } -%>
58+
}}
59+
src="usage/v<%= version %>/<%= nameWithoutIon %>/<%= path %>/demo.html"
60+
/>

_templates/playground/new/index_with_css.md.ejs.t

Lines changed: 0 additions & 37 deletions
This file was deleted.

_templates/playground/new/javascript.md.ejs.t

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
to: "<%= `static/usage/v${version}/${name.replace('ion-', '')}/${path}/javascript.md` %>"
33
---
44
```html
5-
<<%= name %>></<%= name %>><% if (css){ %>
5+
<<%= name %>></<%= name %>>
6+
<% if (css){ -%>
67
78
<style>
89
<%= name %> {
910
/* styles go here */
1011
}
11-
</style><% } %>
12+
</style>
13+
<% } -%>
1214
```

_templates/playground/new/vue.md.ejs.t

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ to: "<%= `static/usage/v${version}/${name.replace('ion-', '')}/${path}/vue.md` %
1616
<%= pascalName %>,
1717
},
1818
});
19-
</script><% if (css){ %>
19+
</script>
20+
<% if (css){ -%>
2021
2122
<style scoped>
2223
<%= name %> {
2324
/* styles go here */
2425
}
25-
</style><% } %>
26+
</style>
27+
<% } -%>
2628
```

0 commit comments

Comments
 (0)