Simplify the theme-handling
This commit is contained in:
parent
683e09f236
commit
b413318097
2 changed files with 22 additions and 5 deletions
|
@ -65,6 +65,11 @@ export class Settings
|
|||
*/
|
||||
private testWebsitePath = "website";
|
||||
|
||||
/**
|
||||
* The name of the theme.
|
||||
*/
|
||||
private themeName = "mantra";
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the `Settings` class.
|
||||
*
|
||||
|
@ -237,4 +242,18 @@ export class Settings
|
|||
{
|
||||
return this.TestPath(this.testWebsitePath, ...path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a path relative to the test-theme.
|
||||
*
|
||||
* @param path
|
||||
* The path to join.
|
||||
*
|
||||
* @returns
|
||||
* The joined path.
|
||||
*/
|
||||
public TestThemePath(...path: string[])
|
||||
{
|
||||
return this.TestWebsitePath("themes", this.themeName, ...path);
|
||||
}
|
||||
}
|
|
@ -90,19 +90,17 @@ export async function Initialize()
|
|||
"assets"
|
||||
];
|
||||
|
||||
let themePath = settings.TestWebsitePath("themes", Path.basename(settings.RootPath()));
|
||||
|
||||
for (let directory of directories)
|
||||
{
|
||||
await FileSystem.emptyDir(settings.RootPath(directory));
|
||||
}
|
||||
|
||||
if (await FileSystem.pathExists(themePath))
|
||||
if (await FileSystem.pathExists(settings.TestThemePath()))
|
||||
{
|
||||
await FileSystem.remove(themePath);
|
||||
await FileSystem.remove(settings.TestThemePath());
|
||||
}
|
||||
|
||||
await require("create-symlink")(settings.RootPath(), themePath, { type: "junction" });
|
||||
await require("create-symlink")(settings.RootPath(), settings.TestThemePath(), { type: "junction" });
|
||||
}
|
||||
|
||||
Initialize.description = "Initializes the project.";
|
||||
|
|
Loading…
Reference in a new issue