Preprocessor to run Svelte directives server-side.
npm install @agnos-ui/svelte-preprocess
Preprocessor to run Svelte actions server-side, which are called directives in AgnosUI.
``sh`
npm install @agnos-ui/svelte-preprocess
Add the directivesPreprocess() preprocessor to your svelte.config.js:
`js
import {directivesPreprocess} from '@agnos-ui/svelte-preprocess';
// ...
/* @type {import('@sveltejs/kit').Config} /
const config = {
// ...
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: [
// ... existing preprocessors
// Add the following line:
directivesPreprocess(),
],
// ...
};
export default config;
`
Given the following file:
`svelte
The preprocessor will transform it into something like:
`svelte
`On the server,
ssrAttributes runs all the provided directives with an SSRHTMLElement that implements a subset of the full HTMLElement. The attributes added by the directives on this element are returned by ssrAttributes to be included in the SSR-generated markup.If the element has a
class attribute, the preprocessor will replace it with the classDirective` directive to make sure the value of the class attribute is correctly merged both on the server and on the client with any other class that may be added by some other directive.