Gracile/Vite configuration
API references extracted from the Gracile code base.
Examples, functions, classes, constants, type declarations…
Interface: GracileConfig
Example
/vite.config.js
import { gracileconst gracile: (config?: GracileConfig) => any[]
The main Vite plugin for loading the Gracile framework.
} from '@gracile/gracile/plugin';
import { defineConfigfunction defineConfig(config: UserConfig): UserConfig (+3 overloads)
Type helper to make it easier to use vite.config.ts
accepts a direct
{@link
UserConfig
}
object, or a function that returns it.
The function receives a
{@link
ConfigEnv
}
object.
} from 'vite';
export default defineConfigfunction defineConfig(config: UserConfig): UserConfig (+3 overloads)
Type helper to make it easier to use vite.config.ts
accepts a direct
{@link
UserConfig
}
object, or a function that returns it.
The function receives a
{@link
ConfigEnv
}
object.
({
pluginsUserConfig.plugins?: PluginOption[] | undefined
Array of vite plugins to use.
: [
gracilefunction gracile(config?: GracileConfig | undefined): any[]
The main Vite plugin for loading the Gracile framework.
({
outputGracileConfig.output?: "static" | "server" | undefined
The target output for the build phase.
See the documentation.
: 'server',
devGracileConfig.dev?: {
locals?: ((context: {
nodeRequest: Connect.IncomingMessage;
}) => unknown) | undefined;
} | undefined
Settings for the development mode.
: {
localslocals?: ((context: {
nodeRequest: Connect.IncomingMessage;
}) => unknown) | undefined
Get incoming request context and apply locals for the Gracile request handler.
Useful for mocking the production server.
For server
mode only.
: (_context_context: {
nodeRequest: Connect.IncomingMessage;
}
) => {
return {
requestIdrequestId: `${string}-${string}-${string}-${string}-${string}`
: cryptovar crypto: Crypto
.randomUUIDCrypto.randomUUID(): `${string}-${string}-${string}-${string}-${string}`
Available only in secure contexts.
(),
userEmailuserEmail: string
: 'admin@admin.home.arpa',
};
},
},
routesGracileConfig.routes?: {
exclude?: string[] | undefined;
} | undefined
Settings for routes in /src/routes
.
: {
excludeexclude?: string[] | undefined
Exclude routes with an array of patterns. Useful for debugging.
: ['**/a-defective-route.ts'],
},
}),
],
});
Properties
Property | Type | Default value | Description | Defined in |
---|---|---|---|---|
dev? | object | undefined | Settings for the development mode. | packages/engine/dist/user-config.d.ts:43 |
dev.locals? | (context : object ) => unknown | undefined | Get incoming request context and apply locals for the Gracile request handler. Useful for mocking the production server. For server mode only. | packages/engine/dist/user-config.d.ts:50 |
experimental? | object | undefined | Future, unstable features flags. | packages/engine/dist/user-config.d.ts:99 |
experimental.generateRoutesTypings? | boolean | undefined | Experimental Automatically typed route paths. | packages/engine/dist/user-config.d.ts:104 |
output? | "static" | "server" | 'static' | The target output for the build phase. See the documentation. | packages/engine/dist/user-config.d.ts:39 |
pages? | object | undefined | Settings for pages in /src/routes . | packages/engine/dist/user-config.d.ts:66 |
pages.premises? | object | undefined | Premises are the document and the properties necessary for page template rendering. You can access them via: - .../_my-route/__index.props.json - .../_my-route/__index.doc.html They are accessible with the dev/server handler and are outputted as static files for the static output or for server pre-rendered pages. They can be use for implementing client-side routing. | packages/engine/dist/user-config.d.ts:81 |
pages.premises.exclude? | string [] | undefined | Exclude routes with a glob filter array. | packages/engine/dist/user-config.d.ts:93 |
pages.premises.expose? | boolean | false | packages/engine/dist/user-config.d.ts:85 | |
pages.premises.include? | string [] | undefined | Include routes with a glob filter array. | packages/engine/dist/user-config.d.ts:89 |
routes? | object | undefined | Settings for routes in /src/routes . | packages/engine/dist/user-config.d.ts:57 |
routes.exclude? | string [] | undefined | Exclude routes with an array of patterns. Useful for debugging. | packages/engine/dist/user-config.d.ts:61 |
Function: gracile()
function gracile(config?): any[];
The main Vite plugin for loading the Gracile framework.
Parameters
Parameter | Type | Description |
---|---|---|
|
Gracile configuration. |
Returns
any
[]
Vite plugins. any
is used to prevent Vite typings version mismatches for the plugin API.
Example
/vite.config.js
import { gracileconst gracile: (config?: GracileConfig) => any[]
The main Vite plugin for loading the Gracile framework.
} from '@gracile/gracile/plugin';
import { defineConfigfunction defineConfig(config: UserConfig): UserConfig (+3 overloads)
Type helper to make it easier to use vite.config.ts
accepts a direct
{@link
UserConfig
}
object, or a function that returns it.
The function receives a
{@link
ConfigEnv
}
object.
} from 'vite';
export default defineConfigfunction defineConfig(config: UserConfig): UserConfig (+3 overloads)
Type helper to make it easier to use vite.config.ts
accepts a direct
{@link
UserConfig
}
object, or a function that returns it.
The function receives a
{@link
ConfigEnv
}
object.
({
pluginsUserConfig.plugins?: PluginOption[] | undefined
Array of vite plugins to use.
: [gracilefunction gracile(config?: GracileConfig | undefined): any[]
The main Vite plugin for loading the Gracile framework.
({ outputGracileConfig.output?: "static" | "server" | undefined
The target output for the build phase.
See the documentation.
: 'server' })],
});
Defined in
packages/engine/dist/plugin.d.ts:19