Configuration
Jamrock uses a dev.config.mjs file for build and development configuration.
Basic Configuration
Create dev.config.mjs in your project root:
export default {
src: 'pages',
dest: 'dist',
port: 3000,
host: '0.0.0.0',
quiet: false,
prefix: '@',
public: 'public',
};Configuration Options
| Option | Default | Description |
|---|---|---|
src |
'pages' |
Source directory for routes |
dest |
'dist' |
Build output directory |
port |
3000 |
Development server port |
host |
'127.0.0.1' |
Development server host |
quiet |
false |
Suppress console output |
prefix |
'@' |
Component import prefix |
public |
'public' |
Static assets directory |
CSS Generators
Enable CSS generators for Less and UnoCSS:
export default {
generators: {
less: await import('less'),
},
unocss: true,
};Less
When enabled, use in components:
<style lang="less">
@primary: #79C551;
.button {
color: @primary;
&:hover { color: darken(@primary, 10%); }
}
</style>UnoCSS
When unocss: true is set, UnoCSS utility classes are generated:
<div class="flex gap-4 p-2 text-center">
Content with utilities
</div>Markdown Options
Configure markdown rendering:
export default {
markdown: {
emojify: true,
twemoji: true,
},
};| Option | Default | Description |
|---|---|---|
emojify |
false |
Convert :emoji: to unicode |
twemoji |
false |
Use Twemoji for emoji rendering |
Environment Variables
Access environment variables in your components:
<script>
const nodeEnv = process.env.NODE_ENV;
const apiKey = process.env.API_KEY;
</script>Build-time Variables
Set variables during build:
GIT_REVISION=$(git rev-parse HEAD) jamrock buildRuntime-Specific Config
Different runtimes may have additional options:
export default {
// Node.js specific
server: {
keepAliveTimeout: 65000,
},
// Deno specific
deno: {
permissions: ['net', 'read', 'write'],
},
};Development vs Production
Detect the environment in your code:
<script>
import { redirect } from 'jamrock:conn';
if (process.env.NODE_ENV === 'production') {
// Production-only code
}
</script>