New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(@schematics/angular): cli app redesign #14403
Conversation
3898182
to
2b18d6f
Compare
@alexeagle do you know if this should be part of CLI version 8? |
/> | ||
|
||
<style> | ||
body { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These styles should be in src/styles.css
. But they might be unusable there if the user chooses a CSS extension whose syntax isn't a superset of basic css. like sass
. Perhaps we should make an extra src/demo-styles.css
(or some other name).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to keep them in the index
file (even though not really the way things are normally done) so that the user can easily delete all of the template code in one full swoop.
packages/schematics/angular/application/other-files/app.component.html.template
Outdated
Show resolved
Hide resolved
packages/schematics/angular/application/other-files/app.component.html.template
Outdated
Show resolved
Hide resolved
@@ -7,6 +7,311 @@ | |||
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> | |||
<link rel="icon" type="image/x-icon" href="favicon.ico"> | |||
<link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel users might just forget these here when removing the demo code.
I tried moving them into src/styles.css
like this:
@import "https://fonts.googleapis.com/css?family=Roboto";
@import "https://fonts.googleapis.com/css?family=Roboto+Mono";
@import "https://fonts.googleapis.com/icon?family=Material+Icons";
And it does work, in Chrome at least. But it's not converted to anything else. It relies on native browser support for @import
in CSS. This it wouldn't be a great choice either. Might just be better to keep it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point about it not being obvious for users to delete. Like with the rest of the CSS I like having it all in one place to just focus on one file when removing template code.
What if we add comments for now that say "remove this template code"? I'll implement that for now until we come up with something better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the comments <!-- *** Remove Template Code Below *** -->
and <!-- *** Template Code Ends *** -->
in both template and in index files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That SGTM, let's roll with it.
Looks great to get this into 8, but needs to land by tomorrow |
32b115d
to
e1fcdcf
Compare
@alexeagle let me know if there is anything you need from me! I just made the updates and rebased. |
@sjtrimble I'll pick it up from here and fix the failing tests. They are mostly related to the unit tests and e2e expecting the old structure. |
Followup PR in #14484 |
@sjtrimble could we remove the changes to index.html? We think developers will accidentally leave these behind in their application.
we want it to be sufficient to delete the component and then you have a clean starting point for an app without any of this boilerplate left behind |
For fonts maybe we can use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's not make any changes to the index.html.
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
body, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we move all of these stylesheets into the component itself? We can't rely on people to correctly remove the style sheet from their app.
You can use https://next.angular.io/guide/component-styles#host-context to get the sheets into the top level document stylesheet.
And for the fonts or anything else that can't be added via that method, we could just inject the https://next.angular.io/api/common/DOCUMENT into the component constructor and do manual dom manipulation from there to create and append fonts to the document.head.
Copied over #14484 test fixes per @IgorMinar |
46d3a35
to
c8445f4
Compare
Moved all code to the template file for easy removal, except for body zero padding/margin styles. |
Let's get this done in 8.1. I'm sorry for deferring it but there are still questions to resolve and as much as I love this change, we shouldn't rush it and pollute new projects with code that we'll regret in the future. |
any update on this, it seems that 8.1 has not included this feat |
Let's see if we can release it as part of version 8.2. |
Hi @sjtrimble - We discussed how to take this forward. We would like to include this as part of the 8.2 release. We would like the starter to have the following properties:
|
c8445f4
to
6f38341
Compare
|
70aa987
to
07852d2
Compare
@vikerman FYI ⬆️ |
@@ -7,6 +7,7 @@ | |||
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> | |||
<link rel="icon" type="image/x-icon" href="favicon.ico"> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you mean the extra line space here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering all the complications with the other approaches I've proposed before, I think having everything in this single file is fine, as long as we leave clear comments about what code belongs to the welcome placeholder and can be removed.
I've added a few comments.
@@ -1,21 +1,506 @@ | |||
<!--The content below is only a placeholder and can be replaced.--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you make this a multiline comment full of stars and emojis with a clear text in the middle that the content below should be removed?
something like this, but you can make it even more fancy: https://github.com/angular/angular.js/blob/060bcdeeb9f5181fb885417f68429c86a8e59eb2/src/ngSanitize/sanitize.js#L3-L12
and we should have a similar "banner" at the bottom as well.
<path id="Path_19" data-name="Path 19" d="M4137.529,1027.283l-7.7-3.723,4.417-2.721,7.753,3.723Z" transform="translate(-4125.003 -1015.199)" fill="#fff"/> | ||
</svg> | ||
|
||
<!-- <img src="../assets/animations.png" height="20px" alt="Angular Animations Logo"/> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented out?
|
||
</div> | ||
|
||
<!-- *** Template Code Ends *** --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as mentioned above, this should be a highly visible multiline comment/banner as well so that it's easy to identify. Also at the top you used "placeholder" terminology and down here you are using "Template", can you please make it consistent? thanks!
07852d2
to
3853f88
Compare
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * --> | ||
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * --> | ||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> | ||
<!-- * * * * * * * * * Delete the template below * * * * * * * * * * --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not below :) We can probably leave this sentence out in this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe just say - End of placeholder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh, I said above on the first line and forgot the last sentence :) I like your idea of end of placeholder better! Thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The failures are caused by:
- Few commit messages without a scope
- Size has increased a bit because of the template & style updates
- Failures caused by framework's release as @alan-agius4 pointed out
@vikerman, as discussed, I think we're ready to merge.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
CC: @IgorMinar