100 lines
No EOL
6.1 KiB
JSON
100 lines
No EOL
6.1 KiB
JSON
{
|
|
"uuid": [
|
|
{
|
|
"value": "37b75d50-a4be-4a3b-9bce-c672e434d45c"
|
|
}
|
|
],
|
|
"langcode": [
|
|
{
|
|
"value": "en"
|
|
}
|
|
],
|
|
"type": [
|
|
{
|
|
"target_id": "daily_email",
|
|
"target_type": "node_type",
|
|
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
|
|
}
|
|
],
|
|
"revision_timestamp": [
|
|
{
|
|
"value": "2025-04-21T01:21:23+00:00"
|
|
}
|
|
],
|
|
"revision_uid": [
|
|
{
|
|
"target_type": "user",
|
|
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
|
|
}
|
|
],
|
|
"revision_log": [],
|
|
"status": [
|
|
{
|
|
"value": true
|
|
}
|
|
],
|
|
"uid": [
|
|
{
|
|
"target_type": "user",
|
|
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
|
|
}
|
|
],
|
|
"title": [
|
|
{
|
|
"value": "Easy feature flags"
|
|
}
|
|
],
|
|
"created": [
|
|
{
|
|
"value": "2024-12-22T00:00:00+00:00"
|
|
}
|
|
],
|
|
"changed": [
|
|
{
|
|
"value": "2025-04-21T01:21:23+00:00"
|
|
}
|
|
],
|
|
"promote": [
|
|
{
|
|
"value": false
|
|
}
|
|
],
|
|
"sticky": [
|
|
{
|
|
"value": false
|
|
}
|
|
],
|
|
"default_langcode": [
|
|
{
|
|
"value": true
|
|
}
|
|
],
|
|
"revision_translation_affected": [
|
|
{
|
|
"value": true
|
|
}
|
|
],
|
|
"path": [
|
|
{
|
|
"alias": "\/daily\/2024\/12\/22\/feature-flags",
|
|
"langcode": "en"
|
|
}
|
|
],
|
|
"body": [
|
|
{
|
|
"value": "\n <p>I recently <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2024\/12\/18\/self-hosting-podcast\">switched to self hosting<\/a> the MP3 files for the episodes of the Beyond Blocks podcast.<\/p>\n\n<p>The first step was to upload the files, followed by <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2024\/12\/19\/working-iteratively\">updating the player<\/a> on the episode pages to use the HTML audio element.<\/p>\n\n<p>As I didn't want the player to switch immediately, I wrapped the new code in a feature flag (or feature toggle) to keep the original player active.<\/p>\n\n<p>Later, I could swap the player by enabling the feature flag.<\/p>\n\n<h2 id=\"how-i-did-it\">How I did it<\/h2>\n\n<p>Feature flagging is a straight forward concept.<\/p>\n\n<p>You isolate the code you want to be togglable within a conditional - i.e. an <code>if<\/code> statement - that you can easily change in the future.<\/p>\n\n<p>My website built with Sculpin, so I can add <code>self_host_podcast_episodes: false<\/code> to my sculpin_site.yml file.<\/p>\n\n<p>This will be available as <code>site.self_host_podcast_episodes<\/code> and I can use this in my code to show the appropriate player.<\/p>\n\n<p>Something like:<\/p>\n\n<pre><code class=\"twig\">{% if site.self_host_podcast_episodes %}\n Show the new player.\n{% else %}\n Show the old player.\n{% endif %}<\/code><\/pre>\n\n<h2 id=\"here%27s-the-thing\">Here's the thing<\/h2>\n\n<p>I like feature flags as you can separate deploying a feature from releasing it.<\/p>\n\n<p>The code can be deployed but not active until the feature is enabled.<\/p>\n\n<p>It's easy to enable, and easy to revert if needed.<\/p>\n\n<p>In Drupal applications, I use the <a href=\"https:\/\/www.drupal.org\/project\/feature_toggle\">Feature Toggle module<\/a>, so I can toggle feature flags by logging in and updating a checkbox.<\/p>\n\n<p>I also <a href=\"https:\/\/www.drupal.org\/project\/feature_toggle_twig\">wrote a module<\/a> with a Twig function so I can check if a feature toggle is enabled directly in a Twig template - the same as I'm doing in Sculpin.<\/p>\n\n ",
|
|
"format": "full_html",
|
|
"processed": "\n <p>I recently <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2024\/12\/18\/self-hosting-podcast\">switched to self hosting<\/a> the MP3 files for the episodes of the Beyond Blocks podcast.<\/p>\n\n<p>The first step was to upload the files, followed by <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2024\/12\/19\/working-iteratively\">updating the player<\/a> on the episode pages to use the HTML audio element.<\/p>\n\n<p>As I didn't want the player to switch immediately, I wrapped the new code in a feature flag (or feature toggle) to keep the original player active.<\/p>\n\n<p>Later, I could swap the player by enabling the feature flag.<\/p>\n\n<h2 id=\"how-i-did-it\">How I did it<\/h2>\n\n<p>Feature flagging is a straight forward concept.<\/p>\n\n<p>You isolate the code you want to be togglable within a conditional - i.e. an <code>if<\/code> statement - that you can easily change in the future.<\/p>\n\n<p>My website built with Sculpin, so I can add <code>self_host_podcast_episodes: false<\/code> to my sculpin_site.yml file.<\/p>\n\n<p>This will be available as <code>site.self_host_podcast_episodes<\/code> and I can use this in my code to show the appropriate player.<\/p>\n\n<p>Something like:<\/p>\n\n<pre><code class=\"twig\">{% if site.self_host_podcast_episodes %}\n Show the new player.\n{% else %}\n Show the old player.\n{% endif %}<\/code><\/pre>\n\n<h2 id=\"here%27s-the-thing\">Here's the thing<\/h2>\n\n<p>I like feature flags as you can separate deploying a feature from releasing it.<\/p>\n\n<p>The code can be deployed but not active until the feature is enabled.<\/p>\n\n<p>It's easy to enable, and easy to revert if needed.<\/p>\n\n<p>In Drupal applications, I use the <a href=\"https:\/\/www.drupal.org\/project\/feature_toggle\">Feature Toggle module<\/a>, so I can toggle feature flags by logging in and updating a checkbox.<\/p>\n\n<p>I also <a href=\"https:\/\/www.drupal.org\/project\/feature_toggle_twig\">wrote a module<\/a> with a Twig function so I can check if a feature toggle is enabled directly in a Twig template - the same as I'm doing in Sculpin.<\/p>\n\n ",
|
|
"summary": null
|
|
}
|
|
],
|
|
"feeds_item": [
|
|
{
|
|
"imported": "2025-04-21T01:21:23+00:00",
|
|
"guid": null,
|
|
"hash": "15704c55f5e3b5d6531dc8c8e9ae0182",
|
|
"target_type": "feeds_feed",
|
|
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
|
|
}
|
|
]
|
|
} |