-
Notifications
You must be signed in to change notification settings - Fork 7
config views.yml
This is the file in charge of binding request patterns to actual views. This will show you how to configure the ones shipped with IntellectualServer.
The layout is pretty easy:
views:
your_identifier:
filter: (\/css\/)([A-Za-z0-9])(.css)?
type: css
options:
folder: ./assets/css
What the above snippet does, is to create a view (called your_identifier
) of the type css
, it will listen to any stylesheet name on /css/{name}.css, where the file extension isn't required. We also set a custom foler to read the CSS files from.
The options part is totally optional, and is only used to further customize the setup.
IntellectualServer comes shipped with these view types by default:
- css - CSS Stylesheets
- download - File Downloads (zip, txt, pdf)
- html - HTML Files
- img - Images (png, jpg, jpeg, ico, gif)
- javascript - Javascript Files
- less - LESS Stylesheets (compiles to CSS)
- redirect - Redirect the user
All default views allows you to change the folder from which files are read (redirect.yml is the configuration for the redirect view, and changing the folder option will change the location of that file)
options:
folder: ./new/path
The pattern is built like this:
(group_1)(group_2)(group_3)
, group_1
is the path, group_2
is the file name (or alike) and group_3
is the file extension. All of these can be empty, but there has to be exactly 3 groups - and everything has to be in this order.
Here are some examples:
filter: (\/assets\/img\/)([A-Za-z0-9]*)(.png|.jpg|.jpeg|.ico|.gif)?
filter (\/assets\/less\/)([A-Za-z0-9*)(.css|.less)?
The redirect view is an exception, as there can only be one applied group for this filter
# Valid Example
filter: \/redirect\/([A-Za-z0-9]*)
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