News
Specbee: Integrating Single Directory Components (SDC) and Storybook in Drupal
Let’s dive straight into this intriguing article and discover how leveraging the power of SDC and Storybook can accelerate build time and boost your efficiency.
What is SDC
Did you know that SDC was a contributed module but it is now included in Core from version Drupal 10.3?! SDC, also known as Single Directory Components, represents a new way of structuring and organizing components. What are components? Components in Drupal are reusable building blocks of code that can include Twig templates, metadata, styles, and scripts that needs to be embedded in Drupal templates.
With SDC, developers can easily create components that are swappable and modular, enhancing the overall flexibility and reusability of their codebase.
What is Storybook
Storybook serves as a frontend workshop that helps developers and designers see and test everything in one place before using them in the actual site. What’s better, it is opensource, extremely popular and has a user-friendly interface, making it a tool for modern development workflows!
Storybook lets you develop and test components in isolation. This ensures they work independently before integration. It offers a visual catalog of components so it is easy to see and understand each component’s functionality.
Why integrate SDC with Storybook in Drupal
Integrating SDC with Storybook in Drupal brings many benefits.
It keeps components organized and easy to manage JS and css files, templates, and data flow within components.
You can see and test components in isolation, enhancing the overall maintainability and scalability of UI components.
Speeds up development and ensures everything works perfectly.
Improves collaboration between teams.
Helps maintain a consistent design across the site.
How to integrate SDC with Storybook in Drupal
Setting up and configuring Storybook with Drupal is a straightforward process that involves creating SDC, enabling them, and installing the necessary dependencies. By following a series of steps, developers can seamlessly integrate SDC with Storybook, leveraging tools like Twig and Webpack5 to enhance the templating and rendering capabilities of their components.
Step 1: Setting Up SDC
Enable the SDC core module. It comes out of the box from Drupal 10.1 & above.
If you want to learn how to create SDCs, you can follow this in depth article we wrote previously.
Step 2: Configure Storybook
Install composer require ‘drupal/storybook:^1.0@beta’
Setting up development.service.yml
parameters:
# …
twig.config:
debug: true
cache: false
# Disable development mode in production!
storybook.development: true
cors.config:
enabled: true
allowedHeaders: [‘*’]
allowedMethods: [‘*’]
allowedOrigins: [‘*’]
exposedHeaders: false
maxAge: false
supportsCredentials: true
Run the command:drush role:perm:add anonymous ‘render storybook stories’
Under the root folder, run the below commands to set up the storybook:yarn set version berry echo ‘nodeLinker: node-modules’ >> .yarnrc.yml# Install and configure stock Storybook. yarn dlx sb init –builder webpack5 –type serverCheck out the Storybook Drupal module to learn more.
Step 3: Create Stories for Components
Develop stories for each SDC component to showcase its functionality and variations.
Utilize Twig files to define the structure and content of each component story.
Ensure that each story accurately represents the behavior and appearance of the corresponding component.
Try it out with an example
Here’s an example of the file structure to create an SDC component with Storybook integration. The component here is “formatted-text”.
Here, the atomic component-driven approach is chosen. So, under atoms, we have placed the formatted-text component.Note: SDC components must be placed under the components/ folder.
Coding snippets for the above component:
1. formatted-text.component.yml
2. formatted-text.css
We can create an SCSS file and then compile it into a CSS file. Here’s how to do that in a gulp.js file:
gulp.src([‘.components/**/*.scss’]).pipe(gulpSass()).pipe(gulp.dest([‘./components’]))
3. formatted-text.stories.twig
Here, we create the stories by adding them using the {% story <name> with { args } %} syntax. The {% stories %} tag serves as the wrapper for all {% story %} tags, as outside of it, the stories have no context.
4. formatted-text.twig
The main template file of the SDC component.
Step 4: Generate Component Stories
The Storybook application doesn’t understand stories in Twig format. The stories must be compiled into *.stories.json files. To do so you can run: drush storybook:generate-all-stories
If you want to generate stories while watching for files. You can run this command:
watch –color drush storybook:generate-all-stories
Step 5: Test and iterate
Run the command to start the storybook server and test components: yarn storybook
Iterate on the design and functionality of components based on feedback and testing results.
Continuously refine and improve the SDC components to enhance their usability and performance.
This is how your storybook page will look like:
Final Thoughts
While integrating SDC with Storybook offers numerous advantages, it’s important to consider potential drawbacks. Some systems may experience performance issues, and not all add-ons may work seamlessly with decorators (controllers of different viewport parameters). Complexities may arise when dealing with multi-nested embeds or higher-order components, requiring careful consideration during development.
Despite these challenges, the integration of SDC and Storybook opens up a new level of possibilities for developers. By creating agnostic components that can be used across different platforms, developers can enhance component visibility via Drupal UI and explore future opportunities, such as integrating components via the layout builder API.
https://www.smily.com/engineering/rds-database-migration-series—integrating-ruby-on
Possible future vmm(4)/vmd(8) on arm64
In an exciting move,
Mike Larkin (mlarkin@)
has
requested
hardware for
vmm(4)
development on the arm64 platform:
CVSROOT: /cvs Module name: www Changes by: mlarkin@cvs.openbsd.org 2024/07/27 18:31:12 Modified files: . : want.html Log message: Mac mini M2 needed for vmm(4) development.
This follows
several
earlier
commits
[by Dave Voutila (dv@)]
splitting
vmm(4)/vmd(8)
into
MI
and MD
parts.
FSF Events: Don’t miss Craig Topham’s talk at FOSSY 2024 in Portland, OR on August 2
Author: Source Read more
Microsoft’s CrowdStrike post-mortem
Real Earning App for students with earning proof _ Make money online from Mobile _ Make Money
#saminasyed #workfromhome #makemoneyfromhome
This video is about Real Earning App for students with earning proof | Make money online from Mobile | Make Money
Are you a student looking to earn some extra cash online? Look no further! In this video, we’ll introduce you to a real earning app that’s perfect for students. We’ll walk you through how to use it and provide you with concrete earning proof, so you can see for yourself that making money online is not only possible but also accessible to students. Don’t miss this opportunity to boost your income from the convenience of your mobile device. Start making money today!
#onlineearning #workfromhome #earnmoneyonline #makemoneyfromhome #saminasyed #earningapp
#onlineearningwithoutinvestment #makemoneyonlineinpakistan #onlineearninginpakistanwithoutinvestment #earnfrommobilephone #makemoneyonlineinpakistan #mobilesepaisekaisekamaye #makemoneyonline2023 #earnmoneyonline #howtoearnmoneyonline #makemoneyonline
#saminasyed #workfromhome #onlineearning #howtomakemoneyonline #passiveincome #passiveincomeideas #earnmoney #makemoney #howtoearnmoneyidea #onlineincome #onlinejobs
#studentearningapp #mobilemoney #realearningapp #earningapp
Queries Solved:-
Real Earning App for students with earning proof
Make money online from Mobile
Make Money
best earning apps
new earning apps today
apps that pay you real money
real money making apps
make money playing games
earn money playing games
real money earning app
best apps to earn money
apps that earn money
easy money making apps
legit app to earn money
game earning app
online money making apps
online earning app
cash earning apps
make money from your phone
online money earning app
make money from phone
best earning app without investment
best money earning app
make money from my phone
best online earning app
earn money from your phone
real earning app
real cash earning app
money earning apps without investment
online earning app without investment
free earning app without investment
easy money earning apps
best cash earning apps
earn money from phone
best gaming earning app
how to make money online
make money online
how to make money fast
how to make money
how to make money from home
ways to make money online
earn money online
make money from home
side hustle
passive income ideas
earn money
online earning
how to earn money
how can i make money fast
how can i make money from home
ways to earn money online
how to earn money online for students
how to make money on the internet
how to earn money online without investment
how to make cash fast
ways to earn money from home
how to make money on youtube
how can i earn money online
Earning App
Real Earning App 2023
Content writing
blog writing
Rewrite Content
earn money from home
Data Entry
Data Entry Jobs
Data Entry Jobs 2023
seo jobs
Real Earning
copy paste job
content writing job
make Money Online in pakistan 2023
Digital Marketing
Affiliate Website
Mak
Bionic Robot Palm Hand
Bionic Robot Palm Hand
STEM For Arduino Stm32 Bionic Robot Palm Hand Manipulator Open Source Five-Hand Educational Kit with Ps2/Somatosensory Gloves
Cette technologie va détruire l’humanité.
Mon setup COMPLET (PC / Caméra / Autres) : http://textup.fr/248446PT
Si vous voulez me soutenir, vous pouvez le faire en achetant vos produits technologiques avec ce lien : https://leotechmaker.com/me-soutenir
(Vous ça ne vous change rien au prix de ce que vous achetez, moi je récupère un % de la vente, merci ❤️❤️)
SUIVEZ MOI ICI PARTOUT POUR NE JAMAIS ARRÊTER D’APPRENDRE !
—————————————————
Twitter: / leotechmaker
Instagram: / leotechmaker
TikTok: / leotechmaker
Twitch: / leotechmaker
Mon extension Chrome à installer ABSOLUMENT : http://leotechmaker.com/addon
Si tu es descendu jusque-là, n’oublie pas de liker la vidéo, après tout, t’as bien cliqué sur “en voir plus”, tu peux bien utiliser un clic de plus…
Die mittelalterliche Open World von Mirthwood simuliert sogar Ernteausfälle mit drastischen Folgen
So sind zum Beispiel alle NPCs von den natürlichen Ressourcen der Open World abhängig und können durch Zusammenstöße mit Monstern oder sogar durch Krankheiten versterben.
Extremwetter und die wechselnden Jahreszeiten haben Einfluss auf Ernteerträge – und beeinflussen so dynamisch die Preise für Waren auf dem Marktplatz. Spieler können dadurch zum Beispiel Profit aus der Knappheit bestimmter Rohstoffe schlagen.
Dazu kommen besondere Zufalls-Events wie die Ankunft eines speziellen Händlers am Hafen oder der Ausbruch einer Werwolf-Plage.
Neben dem Leben als Landwirt á la Stardew Valley stehen aber auch ganz andere Pfade in Mirthwood offen: Karrieren als Krieger, Dieb, Jäger oder sogar Künstler sind Optionen.
Mirthwood erscheint am 11. September 2024 bei Steam .