Skip to content

Commit

Permalink
feat: add file-loader for video files and remark-gfm for GitHub markd…
Browse files Browse the repository at this point in the history
…own syntax
  • Loading branch information
ahnl committed Sep 21, 2024
1 parent b44fba5 commit 4ac9c0f
Show file tree
Hide file tree
Showing 4 changed files with 378 additions and 22 deletions.
3 changes: 2 additions & 1 deletion app/syslog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Link from 'next/link';
import { getMemberAvatarUrl } from '@/utils/Member';
import testausorveli from '@/assets/testausorveli.png';
import { PostsGrid } from '@/components/PostsGrid/PostsGrid';
import remarkGfm from 'remark-gfm'

// seems like next.js is bugging
// https://github.com/vercel/next.js/issues/52765
Expand Down Expand Up @@ -77,7 +78,7 @@ async function getPost(slug: string): Promise<Post> {
console.log("Getting post: ", slug)
const { content } = await compileMDX<PostDetails>({
source: raw,
options: { parseFrontmatter: true },
options: { parseFrontmatter: true, mdxOptions: {remarkPlugins: [remarkGfm]} },
components: mdxComponents(slug)
})
const postDetails = await posts.getPostDetails(`${slug}/post.mdx`);
Expand Down
12 changes: 12 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ const config = {
config.module.rules.push({
test: /\.mdx$/, use: 'raw-loader'
})
const prefix = config.assetPrefix ?? config.basePath ?? '';
config.module.rules.push({
test: /\.mp4$/,
use: [{
loader: 'file-loader',
options: {
publicPath: `${prefix}/_next/static/media/`,
outputPath: `../${config.isServer ? '../' : ''}static/media/`,
name: '[name].[hash:8].[ext]',
},
}],
});
return config
}
};
Expand Down
Loading

0 comments on commit 4ac9c0f

Please sign in to comment.