-
Notifications
You must be signed in to change notification settings - Fork 7
generate
Kvantum provides a command that can be used to generate a view declaration based on an already existing folder structure. It will recursively look through a provided folder and find all files and subfolders that can be served using the default Kvantum views. It will then generate the view filter and include any indices.
This command is used in the console. So, you need to have the server up and running, then you just simple enter the command directly into the server console.
/generate
takes two arguments:
- Folder: A folder inside of
kvantum/
that is to be searched for files. The path is relative tokvantum/
, so if you want Kvantum to search through/kvantum/public
you simply usepublic
as the argument. - Base URI path: The URI prefix used to serve these files. Use
none
to serve files using/<subpath>/file
or/file
. An example of this ispublic
that would then serve files over/public/file
instead.
Example: The command usage is easier to understand by example.
The file structure used in this example is:
public
├── assets
│ ├── favicon.ico
│ ├── javascript
│ │ └── KvantumClient.js
│ ├── logo.png
│ └── potato.css
├── index.html
└── test.html
In this case, the command would be /generate public none
.
NOTE: Each generated file will have a unique ID, so you would not actually use da519040-4119-48ac-981d-b24bca8f5c1c, make sure to use the file names included in your console instead.
The console output is:
[Web][Info] Found 3 folder inside of public/
[Web][Info] - public/assets/
[Web][Info] - public/assets/javascript/
[Web][Info] - public/
[Web][Info] Generated views can be found in 'config/da519040-4119-48ac-981d-b24bca8f5c1c.yml'
[Web][Info] Add 'da519040-4119-48ac-981d-b24bca8f5c1c: da519040-4119-48ac-981d-b24bca8f5c1c.yml' to views.yml to load the file
And the content of config/da519040-4119-48ac-981d-b24bca8f5c1c.yml
is:
views:
1afad411-aede-4768-a57c-4f8505272164:
filter: assets/<file>.<extension>
options:
folder: ./public/assets/
type: std
c6a86fe6-80da-411b-a77c-bf535a6cce37:
filter: assets/javascript/<file>.js
options:
folder: ./public/assets/javascript/
type: javascript
d3de354d-a302-48a8-8dbf-3c369a6145d4:
filter: '[file=index].[extension=html]'
options:
folder: ./public/
type: html
To then add the generated view declaration to the server, you can simply add da519040-4119-48ac-981d-b24bca8f5c1c: da519040-4119-48ac-981d-b24bca8f5c1c.yml
to views.yml
as such:
views:
b24bca8f5c1c: da519040-4119-48ac-981d-b24bca8f5c1c.yml
IntellectualServer
Files can be found in .kvantum/config
- Getting Started
- View Patterns
- File Patterns
- server.yml
views.yml- socketFilters.yml
- translations.yml
- SSL
- Getting Started
- Modules
- Hello World
- Plugins
- Events
- Account System
- Authorization
- Application System
- Sessions
- Create a view - OOP based
- Create a view - @Annotation based
- Middleware
- Extending Crush (Templating syntax)
- ViewReturn