- With our prebuilt templates, you can setup a fully functional customer educational
- website for your product & idea in minutes.
+ With our prebuilt templates, you can setup a fully functional course website for your product & idea in minutes.
Similar to the likes of
diff --git a/packages/course-app/lib/scaffoldTemplate.ts b/packages/course-app/lib/scaffoldTemplate.ts
index c11cd0e2..09241f78 100644
--- a/packages/course-app/lib/scaffoldTemplate.ts
+++ b/packages/course-app/lib/scaffoldTemplate.ts
@@ -1,10 +1,10 @@
import chalk from 'chalk';
-import ora from 'ora';
-import fs from 'fs';
-import path from 'path';
-import { fileURLToPath } from 'url';
import { copyCoursesFolder } from '../utils/copyCoursesFolder';
import { copyFolderSync } from '../utils/copyFolder';
+import { fileURLToPath } from 'url';
+import fs from 'fs';
+import ora from 'ora';
+import path from 'path';
// Define the interface for function parameters
interface ScaffoldTemplateParams {
@@ -20,11 +20,9 @@ const __dirname = path.dirname(__filename);
const packageRoot = path.join(__dirname, '..');
const spinner = ora();
-async function rewriteComponentsFile(filePath: string, template: string): Promise {
- const newContent = `export { components } from './${template}';`;
-
+async function rewriteComponentsFile(filePath: string, content: string): Promise {
try {
- fs.writeFileSync(filePath, newContent);
+ fs.writeFileSync(filePath, content);
} catch (error) {
console.error(`Error writing to file: ${error}`);
}
@@ -80,7 +78,11 @@ export async function scaffoldTemplate({
// Update root import of components to reflect only selected template
const componentsIndex = path.join(projectPath, 'src', 'lib', 'components', 'index.ts');
- await rewriteComponentsFile(componentsIndex, template);
+ await rewriteComponentsFile(
+ componentsIndex,
+ `export { components, utils } from './${template}';`
+ );
+ await rewriteComponentsFile(path.join(projectPath, '.env'), `VITE_TEMPLATE=${template}`);
// If the user wants demo courses, copy the courses folder
spinner.text = chalk.yellow('Setting up courses folder...');
diff --git a/packages/course-app/package.json b/packages/course-app/package.json
index 707fb2eb..8e9efac9 100644
--- a/packages/course-app/package.json
+++ b/packages/course-app/package.json
@@ -1,6 +1,6 @@
{
"name": "@classroomio/course-app",
- "version": "0.0.14",
+ "version": "0.0.15",
"private": false,
"main": "dist/create-template.js",
"scripts": {
diff --git a/packages/course-app/src/template/package.json b/packages/course-app/src/template/package.json
index f1ebbc88..afadc5c1 100644
--- a/packages/course-app/src/template/package.json
+++ b/packages/course-app/src/template/package.json
@@ -37,6 +37,7 @@
},
"dependencies": {
"carbon-icons-svelte": "^12.13.0",
+ "dotenv": "^16.5.0",
"rehype-slug": "^6.0.0",
"rehype-unwrap-images": "^1.0.0",
"remark-toc": "^9.0.0",
diff --git a/packages/course-app/src/template/src/app.css b/packages/course-app/src/template/src/app.css
index d4da8d85..2e5fec42 100644
--- a/packages/course-app/src/template/src/app.css
+++ b/packages/course-app/src/template/src/app.css
@@ -1,5 +1,3 @@
-@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto+Slab:wght@100..900&display=swap');
-
@tailwind base;
@tailwind components;
@tailwind utilities;
@@ -92,7 +90,7 @@
@apply border-border;
}
body {
- @apply bg-background text-foreground;
+ @apply bg-background text-foreground font-app;
}
}
diff --git a/packages/course-app/src/template/src/lib/components/bootcamp/CourseCard.svelte b/packages/course-app/src/template/src/lib/components/bootcamp/CourseCard.svelte
index 9b4c18e9..9cf08bce 100644
--- a/packages/course-app/src/template/src/lib/components/bootcamp/CourseCard.svelte
+++ b/packages/course-app/src/template/src/lib/components/bootcamp/CourseCard.svelte
@@ -18,7 +18,7 @@
diff --git a/packages/course-app/src/template/src/lib/components/bootcamp/TestimonialCard.svelte b/packages/course-app/src/template/src/lib/components/bootcamp/TestimonialCard.svelte
index aea0e086..a21ff3df 100644
--- a/packages/course-app/src/template/src/lib/components/bootcamp/TestimonialCard.svelte
+++ b/packages/course-app/src/template/src/lib/components/bootcamp/TestimonialCard.svelte
@@ -20,7 +20,7 @@
diff --git a/packages/course-app/src/template/src/lib/components/bootcamp/index.ts b/packages/course-app/src/template/src/lib/components/bootcamp/index.ts
index d4cf35ed..2491edfb 100644
--- a/packages/course-app/src/template/src/lib/components/bootcamp/index.ts
+++ b/packages/course-app/src/template/src/lib/components/bootcamp/index.ts
@@ -1,9 +1,9 @@
+import Button from './PrimaryButton.svelte';
import type { Component } from 'svelte';
import CoursesPage from './pages/Course.svelte';
+import Footer from './Footer.svelte';
import HomePage from './pages/Home.svelte';
import Navigation from './Navigation.svelte';
-import Footer from './Footer.svelte';
-import Button from './PrimaryButton.svelte';
import type { TemplateComponents } from '$lib/utils/types/template';
export const components: TemplateComponents = {
@@ -13,3 +13,7 @@ export const components: TemplateComponents = {
coursespage: CoursesPage as unknown as Component,
homepage: HomePage as unknown as Component
};
+
+export const utils = {
+ fontLink: 'https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@100..900&display=swap'
+};
diff --git a/packages/course-app/src/template/src/lib/components/bootcamp/pages/Course.svelte b/packages/course-app/src/template/src/lib/components/bootcamp/pages/Course.svelte
index 4430da78..d53a06a7 100644
--- a/packages/course-app/src/template/src/lib/components/bootcamp/pages/Course.svelte
+++ b/packages/course-app/src/template/src/lib/components/bootcamp/pages/Course.svelte
@@ -74,7 +74,7 @@
{section.header.settings.title}
-
+
{section.header.settings.subtitle}
@@ -95,10 +95,10 @@
-
+
{section.courses.settings.title}
-
+
{section.courses.settings.subtitle}
@@ -107,7 +107,7 @@
{#if $courses.length > 0}
-
Filter by
+
Filter by
{#each filter as item}
(viewAll = !viewAll)}
/>
diff --git a/packages/course-app/src/template/src/lib/components/bootcamp/pages/Home.svelte b/packages/course-app/src/template/src/lib/components/bootcamp/pages/Home.svelte
index 865c63c7..6b32d6f8 100644
--- a/packages/course-app/src/template/src/lib/components/bootcamp/pages/Home.svelte
+++ b/packages/course-app/src/template/src/lib/components/bootcamp/pages/Home.svelte
@@ -26,11 +26,11 @@
-
+
{content.settings.title}
-
+
{content.settings.subtitle}
@@ -61,15 +61,15 @@
class="mx-auto flex max-w-6xl flex-col items-center justify-between gap-4 md:flex-row md:items-start"
>
-
+
{aboutSection.settings.title}
{#each aboutSection.settings.benefits.list as items}
-
{items.title}
+
{items.title}
{items.subtitle}
@@ -94,7 +94,7 @@
- {coursesSection.settings.title}
+ {coursesSection.settings.title}
{coursesSection.settings.subtitle}
@@ -113,7 +113,7 @@
@@ -149,7 +149,7 @@
{#if ctaSection?.show}
-
+
{ctaSection.settings.title}
diff --git a/packages/course-app/src/template/src/lib/components/cal/index.ts b/packages/course-app/src/template/src/lib/components/cal/index.ts
index 702c9c26..4081846e 100644
--- a/packages/course-app/src/template/src/lib/components/cal/index.ts
+++ b/packages/course-app/src/template/src/lib/components/cal/index.ts
@@ -1,9 +1,9 @@
+import Button from './PrimaryButton.svelte';
import type { Component } from 'svelte';
import CoursesPage from './pages/Courses.svelte';
+import Footer from './Footer.svelte';
import HomePage from './pages/Home.svelte';
import Navigation from './Navigation.svelte';
-import Footer from './Footer.svelte';
-import Button from './PrimaryButton.svelte';
import type { TemplateComponents } from '$lib/utils/types/template';
export const components: TemplateComponents = {
@@ -13,3 +13,7 @@ export const components: TemplateComponents = {
coursespage: CoursesPage as unknown as Component,
homepage: HomePage as unknown as Component
};
+
+export const utils = {
+ fontLink: 'https://fonts.googleapis.com/css2?family=Cal+Sans&display=swap'
+};
diff --git a/packages/course-app/src/template/src/lib/components/cal/pages/Home.svelte b/packages/course-app/src/template/src/lib/components/cal/pages/Home.svelte
index 7c326b3d..9109613d 100644
--- a/packages/course-app/src/template/src/lib/components/cal/pages/Home.svelte
+++ b/packages/course-app/src/template/src/lib/components/cal/pages/Home.svelte
@@ -46,7 +46,7 @@
{@const content = getPageSection($homePage, SECTION.HERO)}
{#if content?.show}
-
- {content.settings.title}
-
+
+ {content.settings.title}
+
{content.settings.titleHighlight}
-
+
{content.settings.subtitle}
+
+
{/if}
{/if}
diff --git a/packages/course-app/src/template/src/lib/components/examprep/CourseCard.svelte b/packages/course-app/src/template/src/lib/components/examprep/CourseCard.svelte
index 06bea53e..74095f61 100644
--- a/packages/course-app/src/template/src/lib/components/examprep/CourseCard.svelte
+++ b/packages/course-app/src/template/src/lib/components/examprep/CourseCard.svelte
@@ -9,7 +9,7 @@
>
-
{title}
+
{title}
{description}
diff --git a/packages/course-app/src/template/src/lib/components/examprep/index.ts b/packages/course-app/src/template/src/lib/components/examprep/index.ts
index d4cf35ed..50244c05 100644
--- a/packages/course-app/src/template/src/lib/components/examprep/index.ts
+++ b/packages/course-app/src/template/src/lib/components/examprep/index.ts
@@ -1,9 +1,9 @@
+import Button from './PrimaryButton.svelte';
import type { Component } from 'svelte';
import CoursesPage from './pages/Course.svelte';
+import Footer from './Footer.svelte';
import HomePage from './pages/Home.svelte';
import Navigation from './Navigation.svelte';
-import Footer from './Footer.svelte';
-import Button from './PrimaryButton.svelte';
import type { TemplateComponents } from '$lib/utils/types/template';
export const components: TemplateComponents = {
@@ -13,3 +13,8 @@ export const components: TemplateComponents = {
coursespage: CoursesPage as unknown as Component,
homepage: HomePage as unknown as Component
};
+
+export const utils = {
+ fontLink:
+ 'https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto+Slab:wght@100..900&display=swap'
+};
diff --git a/packages/course-app/src/template/src/lib/components/examprep/pages/Course.svelte b/packages/course-app/src/template/src/lib/components/examprep/pages/Course.svelte
index f331c5af..c66ec046 100644
--- a/packages/course-app/src/template/src/lib/components/examprep/pages/Course.svelte
+++ b/packages/course-app/src/template/src/lib/components/examprep/pages/Course.svelte
@@ -66,12 +66,10 @@
{#if section.header?.show}
-
+
-
+
{section.header.settings.title}
@@ -86,7 +84,7 @@
- {section.courses.settings.title}
+ {section.courses.settings.title}
{section.courses.settings.subtitle}
diff --git a/packages/course-app/src/template/src/lib/components/examprep/pages/Home.svelte b/packages/course-app/src/template/src/lib/components/examprep/pages/Home.svelte
index 0d9b0f36..3a2f9d05 100644
--- a/packages/course-app/src/template/src/lib/components/examprep/pages/Home.svelte
+++ b/packages/course-app/src/template/src/lib/components/examprep/pages/Home.svelte
@@ -140,7 +140,7 @@
{#if coursesSection?.show}
- {coursesSection.settings.title}
+ {coursesSection.settings.title}
{coursesSection.settings.subtitle}
@@ -175,7 +175,7 @@
{#if aboutSection?.show}
-
+
{aboutSection.settings.title}
@@ -189,7 +189,7 @@
>
- {item.title}
+ {item.title}
{item.subtitle}
@@ -204,7 +204,7 @@
{#if faqSection?.show}
- {faqSection.settings.title}
+ {faqSection.settings.title}
{#each faqSection.settings.questions as faq}
@@ -219,9 +219,7 @@
class="flex flex-col items-center justify-between space-y-4 bg-blue-800 px-6 py-20 lg:px-10"
>
-
+
{ctaSection.settings.title}
diff --git a/packages/course-app/src/template/src/lib/components/index.ts b/packages/course-app/src/template/src/lib/components/index.ts
index d9a13537..4f289c52 100644
--- a/packages/course-app/src/template/src/lib/components/index.ts
+++ b/packages/course-app/src/template/src/lib/components/index.ts
@@ -1,10 +1,10 @@
-import { components as CalComponents } from './cal';
-import { components as PosthogComponents } from './posthog';
-import { components as ClassicComponents } from './classic';
-import { components as MinimalComponents } from './minimal';
-import { components as ExamprepComponents } from './examprep';
-import { components as WebflowComponents } from './webflow';
-import { components as BootcampComponents } from './bootcamp';
+import { components as BootcampComponents, utils as BootcampUtils } from './bootcamp';
+import { components as CalComponents, utils as CalUtils } from './cal';
+import { components as ClassicComponents, utils as ClassicUtils } from './classic';
+import { components as ExamprepComponents, utils as ExamprepUtils } from './examprep';
+import { components as MinimalComponents, utils as MinimalUtils } from './minimal';
+import { components as PosthogComponents, utils as PosthogUtils } from './posthog';
+import { components as WebflowComponents, utils as WebflowUtils } from './webflow';
function getComponents() {
switch (import.meta.env.VITE_TEMPLATE) {
@@ -25,6 +25,25 @@ function getComponents() {
}
}
-export const components = {
- ...getComponents()
-};
+export const components = getComponents();
+
+function getUtils() {
+ switch (import.meta.env.VITE_TEMPLATE) {
+ case 'posthog':
+ return PosthogUtils;
+ case 'classic':
+ return ClassicUtils;
+ case 'minimal':
+ return MinimalUtils;
+ case 'examprep':
+ return ExamprepUtils;
+ case 'webflow':
+ return WebflowUtils;
+ case 'bootcamp':
+ return BootcampUtils;
+ default:
+ return CalUtils;
+ }
+}
+
+export const utils = getUtils();
diff --git a/packages/course-app/src/template/src/lib/components/minimal/index.ts b/packages/course-app/src/template/src/lib/components/minimal/index.ts
index 702c9c26..a50cd4fe 100644
--- a/packages/course-app/src/template/src/lib/components/minimal/index.ts
+++ b/packages/course-app/src/template/src/lib/components/minimal/index.ts
@@ -1,9 +1,9 @@
+import Button from './PrimaryButton.svelte';
import type { Component } from 'svelte';
import CoursesPage from './pages/Courses.svelte';
+import Footer from './Footer.svelte';
import HomePage from './pages/Home.svelte';
import Navigation from './Navigation.svelte';
-import Footer from './Footer.svelte';
-import Button from './PrimaryButton.svelte';
import type { TemplateComponents } from '$lib/utils/types/template';
export const components: TemplateComponents = {
@@ -13,3 +13,8 @@ export const components: TemplateComponents = {
coursespage: CoursesPage as unknown as Component,
homepage: HomePage as unknown as Component
};
+
+export const utils = {
+ fontLink:
+ 'https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto+Slab:wght@100..900&display=swap'
+};
diff --git a/packages/course-app/src/template/src/lib/components/minimal/pages/Home.svelte b/packages/course-app/src/template/src/lib/components/minimal/pages/Home.svelte
index fd8e3884..fb67b6c7 100644
--- a/packages/course-app/src/template/src/lib/components/minimal/pages/Home.svelte
+++ b/packages/course-app/src/template/src/lib/components/minimal/pages/Home.svelte
@@ -30,7 +30,7 @@
class="flex max-h-full items-center justify-center px-5 py-5 md:h-[60vh] md:px-14 md:py-14"
>
-
+
{content.settings?.title}
diff --git a/packages/course-app/src/template/src/lib/components/posthog/index.ts b/packages/course-app/src/template/src/lib/components/posthog/index.ts
index 702c9c26..feaff29f 100644
--- a/packages/course-app/src/template/src/lib/components/posthog/index.ts
+++ b/packages/course-app/src/template/src/lib/components/posthog/index.ts
@@ -1,9 +1,9 @@
+import Button from './PrimaryButton.svelte';
import type { Component } from 'svelte';
import CoursesPage from './pages/Courses.svelte';
+import Footer from './Footer.svelte';
import HomePage from './pages/Home.svelte';
import Navigation from './Navigation.svelte';
-import Footer from './Footer.svelte';
-import Button from './PrimaryButton.svelte';
import type { TemplateComponents } from '$lib/utils/types/template';
export const components: TemplateComponents = {
@@ -13,3 +13,7 @@ export const components: TemplateComponents = {
coursespage: CoursesPage as unknown as Component,
homepage: HomePage as unknown as Component
};
+
+export const utils = {
+ fontLink: ''
+};
diff --git a/packages/course-app/src/template/src/lib/components/posthog/pages/Home.svelte b/packages/course-app/src/template/src/lib/components/posthog/pages/Home.svelte
index 2e15c770..3b43325e 100644
--- a/packages/course-app/src/template/src/lib/components/posthog/pages/Home.svelte
+++ b/packages/course-app/src/template/src/lib/components/posthog/pages/Home.svelte
@@ -30,7 +30,7 @@
{@const content = getPageSection($homePage, SECTION.HERO)}
{#if content?.show}
-
+
-
-
-
+
+
+
{/if}
{/if}
@@ -101,6 +101,7 @@
{/if}
+
{/if}
@@ -130,6 +131,7 @@
+
{/if}
@@ -142,6 +144,7 @@
{/each}
+
{/if}
diff --git a/packages/course-app/src/template/src/lib/components/webflow/index.ts b/packages/course-app/src/template/src/lib/components/webflow/index.ts
index 702c9c26..8d0f3bf7 100644
--- a/packages/course-app/src/template/src/lib/components/webflow/index.ts
+++ b/packages/course-app/src/template/src/lib/components/webflow/index.ts
@@ -1,9 +1,9 @@
+import Button from './PrimaryButton.svelte';
import type { Component } from 'svelte';
import CoursesPage from './pages/Courses.svelte';
+import Footer from './Footer.svelte';
import HomePage from './pages/Home.svelte';
import Navigation from './Navigation.svelte';
-import Footer from './Footer.svelte';
-import Button from './PrimaryButton.svelte';
import type { TemplateComponents } from '$lib/utils/types/template';
export const components: TemplateComponents = {
@@ -13,3 +13,8 @@ export const components: TemplateComponents = {
coursespage: CoursesPage as unknown as Component,
homepage: HomePage as unknown as Component
};
+
+export const utils = {
+ fontLink:
+ 'https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap'
+};
diff --git a/packages/course-app/src/template/src/routes/+layout.svelte b/packages/course-app/src/template/src/routes/+layout.svelte
index 0bb28d26..63aa36ee 100644
--- a/packages/course-app/src/template/src/routes/+layout.svelte
+++ b/packages/course-app/src/template/src/routes/+layout.svelte
@@ -4,7 +4,7 @@
import { homePage, sharedPage } from '$lib/utils/stores/pages';
import { courses } from '$lib/utils/stores/course';
import { getPageSection } from '$lib/utils/helpers/page';
- import { components } from '$lib/components';
+ import { components, utils } from '$lib/components';
import Transition from '$lib/components/ui/_custom/Transition.svelte';
import type { Page, Section } from '$lib/utils/types/page';
import type { Course } from '$lib/utils/types/course';
@@ -34,10 +34,14 @@
{seo?.settings.title}
+
+
+
+
{#if $homePage.id}
-
+
{#if !$page.url.pathname.includes('course/')}
diff --git a/packages/course-app/src/template/svelte.config.js b/packages/course-app/src/template/svelte.config.js
index d8ffc284..237376d7 100644
--- a/packages/course-app/src/template/svelte.config.js
+++ b/packages/course-app/src/template/svelte.config.js
@@ -1,10 +1,11 @@
-import { mdsvex, escapeSvelte } from 'mdsvex';
+import { escapeSvelte, mdsvex } from 'mdsvex';
+
+import adapter from '@sveltejs/adapter-auto';
+import { createHighlighter } from 'shiki';
+import rehypeSlug from 'rehype-slug';
import rehypeUnwrapImages from 'rehype-unwrap-images';
import remarkToc from 'remark-toc';
-import rehypeSlug from 'rehype-slug';
-import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
-import { createHighlighter } from 'shiki';
/** @type {import('mdsvex').MdsvexOptions} */
const mdsvexOptions = {
@@ -26,7 +27,12 @@ const mdsvexOptions = {
/** @type {import('@sveltejs/kit').Config} */
const config = {
- preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)],
+ preprocess: [
+ vitePreprocess({
+ script: true
+ }),
+ mdsvex(mdsvexOptions)
+ ],
kit: {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
diff --git a/packages/course-app/src/template/tailwind.config.ts b/packages/course-app/src/template/tailwind.config.ts
index 76d57310..ffa2ceb7 100644
--- a/packages/course-app/src/template/tailwind.config.ts
+++ b/packages/course-app/src/template/tailwind.config.ts
@@ -1,7 +1,28 @@
-import { fontFamily } from 'tailwindcss/defaultTheme';
+import 'dotenv/config';
+
import type { Config } from 'tailwindcss';
+import { fontFamily } from 'tailwindcss/defaultTheme';
import tailwindcssAnimate from 'tailwindcss-animate';
+const getFont = (): string => {
+ switch (process.env.VITE_TEMPLATE) {
+ case 'posthog':
+ return 'Matter, sans-serif';
+ case 'classic':
+ return 'Inter, sans-serif';
+ case 'minimal':
+ return 'Inter, sans-serif';
+ case 'examprep':
+ return 'Playfair Display, serif';
+ case 'webflow':
+ return 'Lato, sans-serif';
+ case 'bootcamp':
+ return 'Roboto Slab, serif';
+ default:
+ return 'Cal Sans, sans-serif';
+ }
+};
+
const config: Config = {
darkMode: ['class'],
content: ['./src/**/*.{html,js,svelte,ts}'],
@@ -118,6 +139,9 @@ const config: Config = {
'accordion-up': 'accordion-up 0.2s ease-out',
'caret-blink': 'caret-blink 1.25s ease-out infinite'
}
+ },
+ fontFamily: {
+ app: getFont()
}
},
plugins: [tailwindcssAnimate]
diff --git a/packages/course-app/templates.json b/packages/course-app/templates.json
index 9f956c3b..48ed74e8 100644
--- a/packages/course-app/templates.json
+++ b/packages/course-app/templates.json
@@ -7,6 +7,10 @@
"name": "classic",
"description": "Classic template"
},
+ {
+ "name": "examprep",
+ "description": "Exam prep template"
+ },
{
"name": "minimal",
"description": "Minimal template"
diff --git a/packages/course-app/utils/copyFolder.ts b/packages/course-app/utils/copyFolder.ts
index a5a65b3c..5a6251cd 100644
--- a/packages/course-app/utils/copyFolder.ts
+++ b/packages/course-app/utils/copyFolder.ts
@@ -1,7 +1,6 @@
-import chalk from 'chalk';
+import { CopyFolderParams } from './types';
import fs from 'fs';
import path from 'path';
-import { CopyFolderParams } from './types';
export async function copyFolderSync({
from,