-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(schematics): add shell schematic #9883
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Angular Material Schematics | ||
A collection of Schematics for Angular Material. | ||
|
||
## Collection | ||
- [Shell](shell/README.md) |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
// This is the root config file where the schematics are defined. | ||
{ | ||
"$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json", | ||
"schematics": {} | ||
"schematics": { | ||
// Adds Angular Material to an application without changing any templates | ||
"materialShell": { | ||
"description": "Create a Material shell", | ||
"factory": "./shell", | ||
"schema": "./shell/schema.json", | ||
"aliases": ["material-shell"] | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Material Shell | ||
Adds Angular Material and its depedencies and pre-configures the application. | ||
|
||
- Adds Material and CDK to `package.json` | ||
- Adds Material Icons Stylesheet to `index.html` | ||
- Adds Roboto Font to `index.html` | ||
- Ensure `BrowserAnimationsModule` is installed and included in root module | ||
- Adds pre-configured theme to `.angular-cli.json` file OR adds custom theme scaffolding to `styles.scss` | ||
|
||
Command: `ng generate material-shell --collection=material-schematics` |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {AppConfig} from '../utils/devkit-utils/config'; | ||
|
||
/** | ||
* Create custom theme for the given application configuration. | ||
*/ | ||
export function createCustomTheme(app: AppConfig) { | ||
const name = app.name || 'app'; | ||
return ` | ||
// Custom Theming for Angular Material | ||
// For more information: https://material.angular.io/guide/theming | ||
@import '~@angular/material/theming'; | ||
// Plus imports for other components in your app. | ||
|
||
// Include the common styles for Angular Material. We include this here so that you only | ||
// have to load a single css file for Angular Material in your app. | ||
// Be sure that you only ever include this mixin once! | ||
@include mat-core(); | ||
|
||
// Define the palettes for your theme using the Material Design palettes available in palette.scss | ||
// (imported above). For each palette, you can optionally specify a default, lighter, and darker | ||
// hue. Available color palettes: https://www.google.com/design/spec/style/color.html | ||
$${name}-primary: mat-palette($mat-indigo); | ||
$${name}-accent: mat-palette($mat-pink, A200, A100, A400); | ||
|
||
// The warn palette is optional (defaults to red). | ||
$${name}-warn: mat-palette($mat-red); | ||
|
||
// Create the theme object (a Sass map containing all of the palettes). | ||
$${name}-theme: mat-light-theme($${name}-primary, $${name}-accent, $${name}-warn); | ||
|
||
// Include theme styles for core and each component used in your app. | ||
// Alternatively, you can import and @include the theme mixins for each component | ||
// that you are using. | ||
@include angular-material-theme($${name}-theme); | ||
|
||
`; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should add a link to the theming guide here in comments