ExtraStatic: powerful and easy publishing

Skip to content
Snippets Groups Projects
Forked from svekyll / svekyll
80 commits behind, 21 commits ahead of the upstream repository.
svelte.config.js 1.03 KiB
import { mdsvex } from 'mdsvex';
import mdsvexConfig from './mdsvex.config.js';
import preprocess from 'svelte-preprocess';
import adapter from '@sveltejs/adapter-static';
import { liquidPreprocessor, svekyllImagePreprocessor } from './src/svekyll/svekyll.js';
import fs from 'fs';
import yaml from 'js-yaml';
import { resolve } from 'path';

try {
	const file = fs.readFileSync('_config.yml', 'utf8');
	const doc = yaml.load(file);
	// console.log('File is: ', file);
	process.env.VITE_JEKYLL_CONFIG = JSON.stringify(doc);
} catch (err) {
	console.log(
		'Unable to process _config.yml, skipping (you may not have a _config.yml and that is fine)'
	);
}

/** @type {import('@sveltejs/kit').Config} */
const config = {
	extensions: ['.svelte', ...mdsvexConfig.extensions],
	kit: {
		adapter: adapter(),
		vite: {
			resolve: {
				alias: {
					$svekyll: resolve('./src/svekyll')
				}
			}
		}
	},

	preprocess: [
		svekyllImagePreprocessor(),
		liquidPreprocessor(),
		preprocess({
			postcss: true
		}),
		mdsvex(mdsvexConfig)
	]
};

export default config;