I like using the custom config.php file, e.g. config.localhost.php, to set a dev flag. However, I’m running localhost with a custom port number (running via so my browsersync will refresh the page as I work). My local url is http://localhost:3000. The kirby config system doesn’t recognize this port number so the settings in config.localhost.php don’t get applied. Is there a workaround?
I just tested this with localhost:3000
and the config file is recognized without any problems. What’s your Kirby version?
I’m running version 2.3.2 for the toolkit, kirby and panel. Here are my config and snippet files. For some reason the output isn’t happening.
site/config/config.localhost.php:
c::set('isDev', true);
and site/snippets/header.php:
<?php if (c::get('isDev')): ?>hello!<? endif ?>
Unfortunately, I can’t reproduce the problem. What is your environment?
Thanks so much texnixe. My gulp process was showing localhost in the url but the domain was defined as a different name in Mamp. Once I renamed my config file to match the real virtual host name, it worked, regardless of port number. It works well like you said.