-
Notifications
You must be signed in to change notification settings - Fork 0
Build profiles
It is common to be simultaneously working with different versions of a website, all of which need to be built in slightly different ways. For example, on some projects I may have a local version of the site so that I can test on my own machine, a development version which gets deployed to a server but is password protected so only the people I want can see it, and a production version that is available to the whole world. In Salal, build profiles are used to store information about how to build the site in each of these cases.
As an example, let's suppose I have a page that will be publicly available at https://apps.myhost.com/myapp/login/. For local testing, the URL for that same page will be http://localhost:5001/login/. Now suppose that on that page, I want to display an image file from a central image directory. This file is at https://apps.myhost.com/myapp/images/pic1.png on the production site, and http://localhost:5001/images/pic1.png. What URL should I use for that image file on my page? Well, it needs to be /myapp/images/pic1.png on the production site, but /images/pic1.png on the test site.
This problem can be solved by creating a variable SITE_ROOT that represents the path to the root directory of the app. On the production site, this would be /myapp, while on the local test site it's left blank. Then in my HTML I can specify the image source like this:
<img src="{{SITE_ROOT}}/images/pic1.png"/>
- Home
- About Salal
- Installation
- Tutorials
- Core concepts
- Getting more out of Salal
- Advanced topics
- Change log