Setting up Gardenjs

During installation, the configuration file garden.config.js is generated in the root directory. All project-specific settings are made here.

Arguments

ArgumentTypeDescription
serverportPositive numberDefault: 3010
Define the server port.
devmodusBooleanDefault: false
!!! For garden development purposes only.
no_open_browserBooleanDefault: true
Stops auto opening Gardenjs on start.
project_titleString, TextDefault: My project name
Title is displayed above the navigation.
project_logoPathOptional. Logo is displayed above the navigation. Then “project_title” is used as title tag.
project_logo_darkmodePathOptional. Logo is displayed above the navigation in dark mode. Then “project_title” is used as title tag.
welcome_pagePathOptional. Set a path to your own start page, e.g. /src/foo.html.
docs_linkBooleanDefault: true
Set a path to your own start page, e.g. /src/foo.svelte.
structurePathEach entry is output with its subpages in the page tree.
E.g. layouts: './src/layout/, 'components: './src/components/'.
watchdirectories: Path, include: File suffixDefines which directories and file types to monitor.
watch: directoriesPathPath to directories to be monitored for changes, e.g. ['./src/'],.
watch: includeFile suffixFile types to be monitored for changes, e.g. [‘.svelte’, ‘.vue’, ‘.scss’, ‘.css’, ‘.js’, ‘.ts’].
vite_configPathDefault: ./vite.config.js
Path to the vite.config file. (In any case, make sure Vite is installed.)
rendererStringSpecify the JS framework(s) used in the project. Requires a corresponding framework plugin. When the npm install script was run, a render was automatically stored here if the appropriate selection was made. E.g. gardenjs-plugin-svelte.
getComponentNameFunctionOption to generate component names in the component tree from dasFileName using your own function.
getComponentFileNamesFunctionOption to generate component file names from dasFileName using your own function. Must return an array. First match will be used.
additional_style_filesPathAdd global style files needed for your project, e.g. 'src/assets/scss/base.scss', 'src/assets/scss/main.scss'
devicessmall: deviceConfig[], medium: deviceConfig[], large: deviceConfig[]Set custom device types for each category.
deviceConfigname: String, w: Number, h: NumberSet name, width and height for a device type.
gridsize: number, style: ‘dotted’ or ‘lined’, color: stringCustom configuration for background grid.
themesname: String, stageBg: Color, active: BooleanEdit or disable “Themes” depending on whether your app uses themes. Defines a list of display modes of your project to output the components accordingly.
themes: nameStringName of the mode as it appears in the theme navigation. E.g. name: 'Dark mode'
themes: stageBgStringSets the background color of the stage for each mode. All common CSS color values can be used as values. E.g. stageBg: '#101010'
themes: activeBooleanSet the default theme on start: active: 'true',. Optionally, if it is empty, the first entry in the list is automatically used as the default.
themeHandlerFunctionThe theme handler allows you to select project-specific themes in Gardenjs.

Pagetree

The source folder of the components was queried during installation. It is also possible to display several page trees one below the other. With the structure option, you can define a finer granulation of the page tree and integrate components from different directories. You could also display external components in your project.

 "structure": {
    "layouts": "./src/layout/",
    "components": "./src/components/",
    "external lib": "/absolute/path/to/lib"
  },

Theme Function

The following theme function is integrated as default. Adapt it to your own needs and adjust the option themeHandler if necessary.

function onThemeChange(theme) {
  if (theme === 'default') {
    delete document.body.dataset.theme
  } else {
    document.body.dataset.theme = theme
  }
}
Vegetable illustration