Skip to content

Commit

Permalink
feat: add svelte-preprocess-import-assets
Browse files Browse the repository at this point in the history
  • Loading branch information
bbtgnn committed Feb 25, 2024
1 parent 5eda2f6 commit de41dea
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@sinclair/typebox": "^0.32.14",
"@sveltejs/adapter-static": "^3.0.1",
"date-fns": "^3.3.1",
"effect": "^2.4.0"
"effect": "^2.4.0",
"svelte-preprocess-import-assets": "^1.1.0"
}
}
22 changes: 22 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,3 @@ import { base } from '$app/paths';
export const href = (route: string) => {
return base ? `${base}${route}` : route;
};

// export const asset = (route: string) => {
// const s = import(route)
// return route;
// };
7 changes: 4 additions & 3 deletions src/routes/(collections)/organizations/dyne/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script lang="ts" context="module">
// import {c} from '$lib/index'
// import { asset } from '$lib/utils';
import logo from './logo.jpeg';
// import logo from './logo.jpeg';
console.log(logo);
// console.log(logo);
export const props = {
name: 'Dyne.org',
Expand All @@ -14,4 +15,4 @@

<pre>{JSON.stringify(props, null, 2)}</pre>

<img src={logo} alt="dyne logo" />
<img src="./logo.jpeg" alt="dyne logo" />
3 changes: 2 additions & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { importAssets } from 'svelte-preprocess-import-assets';

/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: [vitePreprocess({})],
preprocess: [importAssets(), vitePreprocess({})],

kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
Expand Down

0 comments on commit de41dea

Please sign in to comment.