Skip to content
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

Merged
merged 10 commits into from Aug 12, 2019

Conversation

sjtrimble
Copy link
Contributor

  • Updated ng new template design
  • Update favicon to be black as default

CC: @IgorMinar

@sjtrimble sjtrimble changed the title CLI app redesign feat(@angular/cli): cli app redesign May 11, 2019
@sjtrimble
Copy link
Contributor Author

Initial Mockups

Desktop
ngnew-app-desktop-rocket

Mobile
ngnew-app-mobile

@filipesilva
Copy link
Contributor

@alexeagle do you know if this should be part of CLI version 8?

/>

<style>
body {
Copy link
Contributor

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).

Copy link
Contributor Author

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.

@@ -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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@alexeagle alexeagle added this to the 8.0 milestone May 20, 2019
@alexeagle
Copy link
Contributor

Looks great to get this into 8, but needs to land by tomorrow

@sjtrimble sjtrimble force-pushed the ng-new-redesign branch 2 times, most recently from 32b115d to e1fcdcf Compare May 20, 2019 22:51
@sjtrimble
Copy link
Contributor Author

@alexeagle let me know if there is anything you need from me! I just made the updates and rebased.

@filipesilva filipesilva self-assigned this May 21, 2019
@filipesilva
Copy link
Contributor

@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.

@filipesilva
Copy link
Contributor

Followup PR in #14484

@alexeagle
Copy link
Contributor

@sjtrimble could we remove the changes to index.html? We think developers will accidentally leave these behind in their application.

  1. do we really need the custom font? can we avoid using material icons and fall back to browser built-in font?
  2. can we inline as many styles as possible?
  3. if styles are needed on the body, could they be injected by the component constructor

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

@alan-agius4
Copy link
Collaborator

For fonts maybe we can use @import in the components style file?
See support: https://developer.mozilla.org/en-US/docs/Web/CSS/@import

Copy link
Contributor

@IgorMinar IgorMinar left a 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,
Copy link
Contributor

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.

@sjtrimble
Copy link
Contributor Author

Copied over #14484 test fixes per @IgorMinar

@sjtrimble
Copy link
Contributor Author

Moved all code to the template file for easy removal, except for body zero padding/margin styles.

@IgorMinar IgorMinar modified the milestones: 8.0, Backlog May 23, 2019
@IgorMinar
Copy link
Contributor

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.

@vthinkxie
Copy link

any update on this, it seems that 8.1 has not included this feat

@mgechev mgechev modified the milestones: 8.1.x, 8.2.x Jul 19, 2019
@mgechev mgechev added the needs: discussion On the agenda for team meeting to determine next steps label Jul 19, 2019
@mgechev
Copy link
Member

mgechev commented Jul 19, 2019

Let's see if we can release it as part of version 8.2.

@vikerman
Copy link
Contributor

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:

  • No changes to index.html
  • All changes the user need to do while changing it to their are restricted to app.component.html, app.component.css
  • Sort of simple CSS for the app component. The current one is very long
  • Use a system font without needing to link to an external font file

@vikerman vikerman assigned vikerman and unassigned filipesilva Jul 25, 2019
@filipesilva filipesilva removed the needs: discussion On the agenda for team meeting to determine next steps label Jul 25, 2019
@sjtrimble
Copy link
Contributor Author

sjtrimble commented Aug 2, 2019

  1. ✅I rebased on the latest master so everything is fresh.
  2. ✅I removed the external font references/links and replaced with system fonts.
  3. 🔸 Let's chat about the CSS - I think there is value in having a presentable and visually appealing first impression but perhaps we can simplify the code a bit.
  4. ✅I removed everything additional from the index.html file.

@sjtrimble
Copy link
Contributor Author

@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">

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

Copy link
Contributor Author

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?

Copy link
Contributor

@IgorMinar IgorMinar left a 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.-->
Copy link
Contributor

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"/> -->
Copy link
Contributor

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 *** -->
Copy link
Contributor

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!

<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * Delete the template below * * * * * * * * * * -->
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor Author

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 :)

Copy link
Member

@mgechev mgechev left a 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.

@mgechev mgechev requested a review from IgorMinar August 12, 2019 20:52
@mgechev mgechev changed the title feat(@angular/cli): cli app redesign feat(@schematics/angular): cli app redesign Aug 12, 2019
@mgechev mgechev merged commit 40601c4 into angular:master Aug 12, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants