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

Commit

Permalink
npm update, moved structure to config
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiliavir committed Sep 9, 2017
1 parent b0b3597 commit 91c8a15
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ Supporting several configs in this priority:
"baseUrl": "http://localhost/"
}
},
"structureJsonPath": "./partials/site-structure.json",
"structure": {
// ...
},
"destinationPath": "./build/",
"navigationPath": "./partials/",
"ampPath": "./partials/pages/Blog/*.pug",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mvw-creator",
"version": "1.0.11",
"version": "1.1.0",
"description": "Module to generate a static website using pug, scss and typescript.",
"license": "MIT",
"author": {
Expand All @@ -20,7 +20,7 @@
"@types/gulp-load-plugins": "0.0.30",
"@types/jasmine": "2.5.54",
"@types/marked": "0.3.0",
"@types/node": "8.0.26",
"@types/node": "8.0.28",
"@types/strip-json-comments": "0.0.30",
"@types/vinyl": "2.0.1",

Expand All @@ -30,7 +30,7 @@
},
"dependencies": {
"app-module-path": "2.2.0",
"autoprefixer": "7.1.3",
"autoprefixer": "7.1.4",
"copyfiles": "1.2.0",

"gulp": "github:gulpjs/gulp#4.0",
Expand All @@ -47,9 +47,9 @@
"jstransformer-marked": "1.0.2",
"marked": "0.3.6",
"moment": "2.18.1",
"mvw-navigation": "2.0.5",
"mvw-navigation": "2.0.6",
"mvw-search-index": "2.1.4",
"pug": "2.0.0-rc.3",
"pug": "2.0.0-rc.4",
"pug-lint": "2.5.0",
"strip-json-comments": "2.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion ts/creator-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export interface ICreatorConfig {
pugPath: string;
pugLintPath: string;
siteTitle?: string;
structureJsonPath: string;
structure: string;
searchIndex?: ISearchIndexConfig | boolean;
}
10 changes: 6 additions & 4 deletions ts/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as moment from "moment";
import "moment/locale/de";
import { Navigation } from "mvw-navigation";
import { SearchIndex } from "mvw-search-index";
import { EOL } from "os";
import * as path from "path";
import * as File from "vinyl";

Expand Down Expand Up @@ -44,7 +45,7 @@ if (config.environments.base) {

let navigation: Navigation;
const getNavigation = () => {
return navigation || (navigation = new Navigation(require(path.join(process.cwd(), config.structureJsonPath))));
return navigation || (navigation = new Navigation(config.structure));
};

const getScope = (file: File, isAmp: boolean = false) => {
Expand Down Expand Up @@ -92,12 +93,13 @@ const sitemap = () => {

const writeNavigation = () => {
if (config.navigationPath) {
const fel = EOL + EOL;
fs.writeFileSync(path.join(config.navigationPath, "./site-overview.pug"),
getNavigation().writeNavigation("allplain"));
getNavigation().writeNavigation("allplain") + fel);
fs.writeFileSync(path.join(config.navigationPath, "./topnavigation.pug"),
getNavigation().writeNavigation("top"));
getNavigation().writeNavigation("top") + fel);
fs.writeFileSync(path.join(config.navigationPath, "./footernavigation.pug"),
getNavigation().writeNavigation("footer"));
getNavigation().writeNavigation("footer") + fel);
}
};

Expand Down

0 comments on commit 91c8a15

Please sign in to comment.