Skip to content

demo(prerender): add theme to prerender demo #13516

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 1 commit into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/universal-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Angular Material Universal Kitchen Sink Test</title>
<link href="theme.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<base href="/">
</head>
<body>
Expand Down
16 changes: 8 additions & 8 deletions src/universal-app/kitchen-sink/kitchen-sink.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ <h2>Autocomplete</h2>
<h2>Button</h2>

<button mat-button>go</button>
<button mat-icon-button>go</button>
<button mat-icon-button><mat-icon>search</mat-icon></button>
<button mat-raised-button>go</button>
<button mat-fab>go</button>
<button mat-mini-fab>go</button>
<button mat-fab><mat-icon>home</mat-icon></button>
<button mat-mini-fab><mat-icon>favorite</mat-icon></button>

<a mat-button href="https://google.com">Google</a>
<a mat-icon-button href="https://google.com">Google</a>
<a mat-icon-button href="https://google.com"><mat-icon>search</mat-icon></a>
<a mat-raised-button href="https://google.com">Google</a>
<a mat-fab href="https://google.com">Google</a>
<a mat-mini-fab href="https://google.com">Google</a>
<a mat-fab href="https://google.com"><mat-icon>home</mat-icon></a>
<a mat-mini-fab href="https://google.com"><mat-icon>favorite</mat-icon></a>

<h2>Button toggle</h2>

Expand Down Expand Up @@ -107,7 +107,7 @@ <h2>Grid list</h2>
</mat-grid-list>

<h2>Icon</h2>
<mat-icon>ligature</mat-icon>
<mat-icon>grade</mat-icon>

<h2>Input</h2>

Expand Down Expand Up @@ -361,6 +361,6 @@ <h2>Focus trap</h2>

<h2>Badge</h2>

<button mat-raised-button matBadge="Clicked 1337 times">
<button mat-raised-button matBadge="99">
Clicky thing
</button>
16 changes: 16 additions & 0 deletions src/universal-app/theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@import '../lib/core/theming/all-theme';
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't we reuse one of the prebuilt themes here? That's what we do for the unit tests: https://github.com/angular/material2/blob/master/test/karma.conf.js#L39

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 could if you feel strongly that we should do that. I did it this way because I plan to work on some prototypes with MDC that would add optional flags to the theme mixins.

Copy link
Member

Choose a reason for hiding this comment

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

I don't feel strongly about it, I wasn't aware that we needed it for more than just a theme.


// 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 default theme (same as the example above).
$candy-app-primary: mat-palette($mat-indigo);
$candy-app-accent: mat-palette($mat-pink, A200, A100, A400);
$candy-app-theme: mat-light-theme($candy-app-primary, $candy-app-accent);

// Include the default theme styles.
@include angular-material-theme($candy-app-theme);
11 changes: 7 additions & 4 deletions tools/gulp/tasks/universal.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {task} from 'gulp';
import {dest, task} from 'gulp';
import {ngcBuildTask, tsBuildTask, copyTask, execTask} from '../util/task_helpers';
import {join} from 'path';
import {copySync} from 'fs-extra';
import {buildConfig, sequenceTask} from 'material2-build-tools';
import {buildConfig, buildScssPipeline, sequenceTask} from 'material2-build-tools';

const {outputDir, packagesDir} = buildConfig;

Expand Down Expand Up @@ -36,13 +36,16 @@ task('universal:build', sequenceTask(
'clean',
['material:build-release', 'cdk:build-release'],
['universal:copy-release', 'universal:copy-files'],
'universal:build-app-ts',
'universal:build-prerender-ts'
['universal:build-app-ts', 'universal:build-app-scss'],
'universal:build-prerender-ts',
));

/** Task that builds the universal app in the output directory. */
task('universal:build-app-ts', ngcBuildTask(tsconfigAppPath));

/** Task that builds the universal app styles in the output directory. */
task('universal:build-app-scss', () => buildScssPipeline(appDir).pipe(dest(outDir)));

/** Task that copies all files to the output directory. */
task('universal:copy-files', copyTask(appDir, outDir));

Expand Down