Skip to content

config views.yml

Alexander Söderberg edited this page Jul 8, 2015 · 1 revision

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.

Layout

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.

View Types

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

Options

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

Pattern (filter)

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)?

redirect

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]*)

Navigation

Templates

Configuration

Files can be found in .kvantum/config

Views

/commands

Development

Clone this wiki locally