Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
feat(examples): add release version to the site header
Browse files Browse the repository at this point in the history
 - generate public/version.json file that contains version information.
  • Loading branch information
justindujardin committed Dec 20, 2015
1 parent 3ea1270 commit 4aa3bee
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dist/
out/
site/
public/meta.json
public/version.json

ng2-material/**/*.css
ng2-material/**/*.css.map
Expand Down
5 changes: 5 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ module.exports = function (grunt) {
var path = require('path');
var util = require('util');
var meta = {};

fs.writeFileSync('public/version.json',JSON.stringify({
version: require('./package.json').version
}));

glob("examples/components/**/*.html", function (err, files) {
files.forEach(parseDemo);
var output = prepareMeta();
Expand Down
2 changes: 1 addition & 1 deletion examples/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</button>
<h2>
<span>Angular2 Material</span>
<span *ngIf="version" class="md-caption" flex>v{{version}}</span>
</h2>
<span flex></span>
</div>
</md-toolbar>

Expand Down
3 changes: 0 additions & 3 deletions examples/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ $md-font-url: '../public/font/';
@import "example";

demos-app {
.md-toolbar {
max-width: 200px;
}
md-content {
> section {
max-width: 800px;
Expand Down
8 changes: 6 additions & 2 deletions examples/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export interface IExampleData {
export class DemosApp {
meta: any;

version: string;

constructor(http: Http) {
http.get('public/meta.json')
.subscribe((res: Response) => {
Expand All @@ -44,8 +46,10 @@ export class DemosApp {
// }
//});
//this.meta = results;

console.log(this.meta);
});
http.get('public/version.json')
.subscribe((res: Response) => {
this.version = res.json().version;
});
}
}
Expand Down

0 comments on commit 4aa3bee

Please sign in to comment.