Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 7 additions & 1 deletion projects/scullyDocs/src/assets/scully-routes.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{"route": "/"},
{"route": "/docs/blog", "title": "Adding Blog Support", "order": 600, "sourceFile": "blog.md"},
{
"route": "/docs/CODE_OF_CONDUCT",
"title": "Code of Conduct",
"order": 900,
"sourceFile": "CODE_OF_CONDUCT.md"
},
{"route": "/docs/blog", "title": "Adding Blog Support", "order": 600, "sourceFile": "blog.md"},
{"route": "/docs/features", "title": "Features", "order": 1900, "sourceFile": "features.md"},
{
"route": "/docs/getting-started",
Expand Down Expand Up @@ -55,6 +55,12 @@
"sourceFile": "scully-configuration.md"
},
{"route": "/docs/scully-lib-core", "title": "Core", "order": 500, "sourceFile": "scully-lib-core.md"},
{
"route": "/docs/scully-provided-plugins",
"title": "Scully system plugins",
"order": 700,
"sourceFile": "scully-provided-plugins.md"
},
{"route": "/docs/scully", "sourceFile": "scully.md"},
{"route": "/docs/showcase", "sourceFile": "showcase.md"},
{"route": "/docs/utils", "sourceFile": "utils.md"},
Expand Down
2 changes: 1 addition & 1 deletion scully.sampleBlog.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exports.config = {
type: 'contentFolder',
// postRenderers: ['toc'],
slug: {
folder: './blog',
folder: './blog-files',
},
},
'/slow': {
Expand Down
2 changes: 1 addition & 1 deletion scully/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scullyio/scully",
"version": "0.0.83",
"version": "0.0.85",
"description": "Scully CLI",
"repository": {
"type": "GIT",
Expand Down
17 changes: 9 additions & 8 deletions scully/routerPlugins/contentFolderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {RouteTypeContentFolder} from '../utils/interfacesandenums';
import {log, logWarn, yellow} from '../utils/log';
import {HandledRoute} from './addOptionalRoutesPlugin';

let basePath: string;

export async function contentFolderPlugin(
angularRoute: string,
conf: RouteTypeContentFolder
Expand All @@ -20,9 +22,9 @@ export async function contentFolderPlugin(
return [];
}
const baseRoute = angularRoute.split(':' + param)[0];
const path = join(scullyConfig.homeFolder, paramConfig.folder);
log(`Finding files in folder "${yellow(path)}"`);
return await checkSourceIsDirectoryAndRun(path, baseRoute, conf);
basePath = join(scullyConfig.homeFolder, paramConfig.folder);
log(`Finding files in folder "${yellow(basePath)}"`);
return await checkSourceIsDirectoryAndRun(basePath, baseRoute, conf);
}

async function checkSourceIsDirectoryAndRun(path, baseRoute, conf) {
Expand Down Expand Up @@ -60,12 +62,11 @@ async function addHandleRoutes(sourceFile, baseRoute, templateFile, conf, ext) {
let routify = frag => `${baseRoute}${slugify(frag)}`;
// replace \ for / for windows
const newTemplateFile = templateFile.split('\\').join('/');
if (!newTemplateFile.endsWith(`${baseRoute}${sourceFile}`)) {
const position = newTemplateFile.search(baseRoute);
const br = newTemplateFile.substr(position).replace(sourceFile, '');
routify = frag => `${br}${slugify(frag)}`;
if (!newTemplateFile.endsWith(`${basePath}/${sourceFile}`)) {
/** get the 'path' part of as a route partial */
const routePartial = newTemplateFile.substr(basePath.length + 1).replace(sourceFile, '');
routify = frag => `${baseRoute}${routePartial}${slugify(frag)}`;
}
// is a folder we need iterate the content in the folder
const {meta, prePublished} = await readFileAndCheckPrePublishSlug(templateFile);
const name = conf.name;
const handledRoute: HandledRoute = {
Expand Down