Skip to content

Commit

Permalink
page resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
jadok committed Sep 4, 2018
1 parent 79851a6 commit d0e82c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cli/.setup-folder/app/themes/black/pages/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BasePage } from 'vemsy'
import { MainStyle } from '../interpreters/style/main'
import { DefaultTemplate } from '../interpreters/template/default'

export class DefaultPage extends BasePage {
export default class DefaultPage extends BasePage {
public regex = '/'
public style = new MainStyle()
public template = new DefaultTemplate()
Expand Down
4 changes: 0 additions & 4 deletions core/index.ts

This file was deleted.

8 changes: 7 additions & 1 deletion core/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,22 @@ export class ThemeManager {
filter: /(.+)\.ts$/,
optional: true
})
console.log('Configured pages', this.configs.pages)
}

public loadPages(configs: any = this.configs.pages) {
console.log('Load pages')
Object.keys(configs).forEach((key: any) => {
const attribute = themeAttributes(key, 'Page')
console.log(key, attribute)
if (!checkSubVars(configs, key, attribute)) {
console.log('check failed')
this.loadPages(configs[key])
}
else {
const page = new configs[key][attribute]()
console.log('check suceed', configs, key, attribute, configs[key], configs[key][attribute])
const page = configs[key][attribute]()
console.log('NEW')
if (this.pages.hasOwnProperty(page.regex)) {
console.error(`The regex ${page.regex} already has a page defined.`)
}
Expand Down

0 comments on commit d0e82c1

Please sign in to comment.