Skip to content

Commit

Permalink
feat: Optional theme support for Angular projects add, closes #272
Browse files Browse the repository at this point in the history
  • Loading branch information
wnvko committed Jul 16, 2018
1 parent 4683fae commit c94e1a6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion templates/angular/igx-ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AngularFramework extends BaseProjectLibrary {
super(__dirname);
this.name = "Ignite UI for Angular";
this.projectType = "igx-ts";
this.themes = ["infragistics"];
this.themes = ["Custom", "Default"];
}
}
module.exports = new AngularFramework();
2 changes: 1 addition & 1 deletion templates/angular/igx-ts/projects/empty/files/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"src/assets"
],
"styles": [
"src/styles.scss"
"src/styles.scss"$(DefaultTheme)
],
"scripts": ["./node_modules/hammerjs/hammer.min.js"]
},
Expand Down
15 changes: 1 addition & 14 deletions templates/angular/igx-ts/projects/empty/files/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/* You can add global styles to this file, and also import other style files */
/* See: https://www.infragistics.com/products/ignite-ui-angular/angular/components/themes.html */
@import "~igniteui-angular/lib/core/styles/themes/index";

$primary: #731963 !default;
$secondary: #ce5712 !default;

$app-palette: igx-palette($primary, $secondary);

@include igx-core();
@include igx-theme($app-palette);

//$navbar-theme: igx-navbar-theme($background: #731963)
//@include igx-navbar($navbar-theme)

$(CustomTheme)
.content p {
margin: 15px;
}
28 changes: 28 additions & 0 deletions templates/angular/igx-ts/projects/empty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ class EmptyJsBlocksProject implements ProjectTemplate {
public projectType: string = "igx-ts";
public hasExtraConfiguration: boolean = false;

private CUSTOM_THEME
= `/* See: https://www.infragistics.com/products/ignite-ui-angular/angular/components/themes.html */
@import "~igniteui-angular/core/styles/themes/index";
$primary: #731963 !default;
$secondary: #ce5712 !default;
$app-palette: igx-palette($primary, $secondary);
@include igx-core();
@include igx-theme($app-palette);
`;
private DEFAULT_THEME = `,
"node_modules/igniteui-angular/styles/igniteui-angular.css"`;

public installModules(): void {
throw new Error("Method not implemented.");
}
Expand All @@ -22,12 +37,25 @@ class EmptyJsBlocksProject implements ProjectTemplate {
public setExtraConfiguration(extraConfigKeys: any[]) { }
public generateFiles(outputPath: string, name: string, theme: string, ...options: any[]): Promise<boolean> {
const config = {
"$(CustomTheme)": "",
"$(DefaultTheme)": "",
"$(cliVersion)": Util.version(),
"$(dash-name)": Util.lowerDashed(name),
"$(name)": name,
"$(theme)": theme,
"__path__": name
};

switch (theme) {
case "Custom":
config["$(CustomTheme)"] = this.CUSTOM_THEME;
break;
case "Default":
default:
config["$(DefaultTheme)"] = this.DEFAULT_THEME;
break;
}

const pathsConfig = {};
return Util.processTemplates(path.join(__dirname, "./files"), path.join(outputPath, name), config, pathsConfig);
}
Expand Down

0 comments on commit c94e1a6

Please sign in to comment.