SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
FRONT-END COMPONENTS IN DRUPAL THEME. "KAIZEN" -
DRUPAL 8 THEME FROM SKILLD
DRUPALCAMP KYIV'19
Sergiy Borodylin
Skilld - Drupal front-end developer
DevCompany - Co-founder
● https://www.facebook.com/hog.seruj
● https://www.drupal.org/u/hog
Problem with Implementation BEM
components to Drupal render
Components + BEM
Patternlab
● Atoms
● Molecules
● Organisms
● Helpers
● Layouts
BEM
● Block
● Element
● Modifier
block-name__elem-name_mod-name_m
od-val
Block - main rules
● Block is fully independent
● Block can be placed in any place of the page
● Block shouldn't influence its environment, meaning you shouldn't set the
external geometry (margin) or positioning for the block.
● You also shouldn't use CSS tag or ID selectors when using BEM.
Yarn + webpack
Gulp removed
"scripts": {
"build": "cross-env ./node_modules/.bin/webpack",
"dev": "cross-env NODE_ENV=development ./node_modules/.bin/webpack --config
webpack.config.dev.js",
"debug": "cross-env NODE_ENV=debug ./node_modules/.bin/webpack --config
webpack.config.dev.js",
"lint": "cross-env ./node_modules/.bin/run-p lint:*",
"lint-fix": "cross-env ./node_modules/.bin/run-p "lint:* --fix"",
"lint:js": "node ./node_modules/eslint/bin/eslint.js .",
"lint:css": "cross-env ./node_modules/.bin/stylelint "**/*.css"",
"lint:sass": "cross-env ./node_modules/.bin/stylelint "**/*.scss" --config
./.stylelintrc.sass.json",
"browsersync": "yarn run browser-sync start --proxy '127.0.0.1:8888' --files ./dist",
"watch": "cross-env ./node_modules/.bin/webpack -w",
"watch:bs": "cross-env NODE_ENV=development ./node_modules/.bin/run-p browsersync watch",
"icons": "svg-sprite --config ./scripts/icons/svg-sprite.json ./images/svg/*.svg",
"cc": "node ./scripts/create-component.js"
}
package.json
webpack.config.js
const glob = require('glob');
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const breakpointsImporter = require('./scripts/importers/breakpoints-importer');
const options = require('./kaizen-options');
const mapFilenamesToEntries = (pattern, globOptions) =>
glob.sync(pattern, globOptions).reduce((entries, filename) => {
const [, name] = filename.match(/([^/]+) .scss$/);
return {
...entries,
[name]: filename,
};
}, {});
Stylelint
Stylelint replacing csslint in core - https://www.drupal.org/node/2868114
.stylelintrc.sass.json
{
"extends": [
"./.stylelintrc.json",
"stylelint-config-recommended-scss"
],
"rules": {
"plugin/no-browser-hacks": null,
"order/order": [
"custom-properties",
"dollar-variables",
{
"type": "at-rule",
"hasBlock": false
},
We create front-end components from
console
node ./scripts/create-component.js
? Please enter component name test_example
? What type of component? (Use arrow keys)
❯ Atom
Molecule
Organism
Template
Helper
? Create elements instead default COMPONENT__content? (y/N)
? (QUESTION PLACEHOLDER. NOT WORKING YET)Create record in *.libraries.yml?
(y/N)
? Create twig template? (y/N)
? Enter element name content
? Want to enter another element (just hit enter for YES)? No
@import '../../../init';
$name: 'a-test-example';
.#{$name},
%#{$name} {
display: inherit;
}
<div class="a-test-example">
<div class"a-test-example__content">{{ content.content }}</div>
</div>
@import 'a-test-example';
// .DRUPAL-SELECTOR {
// @extend %a-test-example;
// }
Module color and css vars
:root {
--color-1: #000;
--color-2: #b9bab9;
--color-3: #fff;
--color-4: #37B480;
--color-5: #52C998;
--color-6: #353535;
--color-7: #1b1464;
}
:root {
--color-bg: var(--color-7);
--color-text: var(--color-6);
--color-link: var(--color-3);
--color-link--hover: var(--color-4);
}
Breakpoints
theme_name.breakpoints.yml
theme_name.mobile:
label: mobile
mediaQuery: 'all and (max-width: 639px)'
weight: 0
group: name
multipliers:
- 1x
- 2x
theme_name.narrow:
label: narrow
mediaQuery: 'all and (min-width: 640px) and (max-width: 1023px)'
weight: 1
group: name
multipliers:
- 1x
- 2x
theme_name.wide:
label: wide
mediaQuery: 'all and (min-width: 1024px)'
weight: 2
group: name
multipliers:
- 1x
- 2x
@include respond-to(wide_1x) {}
Migrate from scss to post css - causes
and disadvantages
Done
● Removed sass and its dependencies.
● Moved variables to custom css props.
● Added nested plugin to make css sass like
● Added import plugin
● Added drupal custom plugin breakpoints
● Added test examples of variables/colors/breakpoints/components/nested
Things to do
● Fix linter issues After compiling.
● Rework create component task
● Check watcher and other tasks.
● Test with docker.
● Check sourcemaps generation
No jQuery. ES6
You don’t need jQuery
Style guide integration
theme_name.components.yml
info-box:
label: Info Box
type: twig
description: Info Box
group: 02 Theme Molecules
content:
items:
- <div class="m-info-box__field-wrapper"><div class="m-info-box__field-title">Field
title</div><div class="m-info-box__field-content">Field content</div></div>
- <div class="m-info-box__field-wrapper"><div class="m-info-box__field-title">Field
title</div><div class="m-info-box__field-content">Field content</div></div>
- <div class="m-info-box__field-wrapper"><div class="m-info-box__field-title">Field
title</div><div class="m-info-box__field-content">Field content</div></div>
- <div class="m-info-box__field-wrapper"><div class="m-info-box__field-title">Field
title</div><div class="m-info-box__field-content">Field content</div></div>
modifiers:
background-one: m-info-box__title--background-1
template: /src/sass/components/molecules/info-box/m-info-box.twig
Theme for developer VS theme for
customer
Questions?

Contenu connexe

Similaire à FRONT-END COMPONENTS IN DRUPAL THEME. "KAIZEN" - DRUPAL 8 THEME FROM SKILLD

GuiReflectAppbuild.xml Builds, tests, and runs the pro.docx
GuiReflectAppbuild.xml      Builds, tests, and runs the pro.docxGuiReflectAppbuild.xml      Builds, tests, and runs the pro.docx
GuiReflectAppbuild.xml Builds, tests, and runs the pro.docxshericehewat
 
D7 theming what's new - London
D7 theming what's new - LondonD7 theming what's new - London
D7 theming what's new - LondonMarek Sotak
 
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal StackDecoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stacknuppla
 
Development based on Drupal's Fundamental Particles - Brad Czerniak for jam's...
Development based on Drupal's Fundamental Particles - Brad Czerniak for jam's...Development based on Drupal's Fundamental Particles - Brad Czerniak for jam's...
Development based on Drupal's Fundamental Particles - Brad Czerniak for jam's...Jeffrey McGuire
 
Intro to Theming Drupal, FOSSLC Summer Camp 2010
Intro to Theming Drupal, FOSSLC Summer Camp 2010Intro to Theming Drupal, FOSSLC Summer Camp 2010
Intro to Theming Drupal, FOSSLC Summer Camp 2010Emma Jane Hogbin Westby
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Anne Tomasevich
 
Joomla Day UK 2009 Template Design Presentation
Joomla Day UK 2009 Template Design PresentationJoomla Day UK 2009 Template Design Presentation
Joomla Day UK 2009 Template Design PresentationChris Davenport
 
Joomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template DesignJoomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template DesignAndy Wallace
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017Ayush Sharma
 
#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)
#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)
#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)Konstantin Komelin
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e bigAndy Peterson
 
Display Suite: A Themers Perspective
Display Suite: A Themers PerspectiveDisplay Suite: A Themers Perspective
Display Suite: A Themers PerspectiveMediacurrent
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Siva Epari
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Developmentipsitamishra
 
Workflow Essentials for Web Development
Workflow Essentials for Web DevelopmentWorkflow Essentials for Web Development
Workflow Essentials for Web DevelopmentXavier Porter
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practicesmanugoel2003
 
Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend developmentsparkfabrik
 

Similaire à FRONT-END COMPONENTS IN DRUPAL THEME. "KAIZEN" - DRUPAL 8 THEME FROM SKILLD (20)

GuiReflectAppbuild.xml Builds, tests, and runs the pro.docx
GuiReflectAppbuild.xml      Builds, tests, and runs the pro.docxGuiReflectAppbuild.xml      Builds, tests, and runs the pro.docx
GuiReflectAppbuild.xml Builds, tests, and runs the pro.docx
 
D7 theming what's new - London
D7 theming what's new - LondonD7 theming what's new - London
D7 theming what's new - London
 
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal StackDecoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
 
Development based on Drupal's Fundamental Particles - Brad Czerniak for jam's...
Development based on Drupal's Fundamental Particles - Brad Czerniak for jam's...Development based on Drupal's Fundamental Particles - Brad Czerniak for jam's...
Development based on Drupal's Fundamental Particles - Brad Czerniak for jam's...
 
Intro to Theming Drupal, FOSSLC Summer Camp 2010
Intro to Theming Drupal, FOSSLC Summer Camp 2010Intro to Theming Drupal, FOSSLC Summer Camp 2010
Intro to Theming Drupal, FOSSLC Summer Camp 2010
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8
 
Joomla Day UK 2009 Template Design Presentation
Joomla Day UK 2009 Template Design PresentationJoomla Day UK 2009 Template Design Presentation
Joomla Day UK 2009 Template Design Presentation
 
Joomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template DesignJoomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template Design
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017
 
#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)
#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)
#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)
 
#D8 cx: upgrade your modules to drupal 8
#D8 cx: upgrade your modules to drupal 8 #D8 cx: upgrade your modules to drupal 8
#D8 cx: upgrade your modules to drupal 8
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
Display Suite: A Themers Perspective
Display Suite: A Themers PerspectiveDisplay Suite: A Themers Perspective
Display Suite: A Themers Perspective
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Development
 
Workflow Essentials for Web Development
Workflow Essentials for Web DevelopmentWorkflow Essentials for Web Development
Workflow Essentials for Web Development
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Forensic Theming for Drupal
Forensic Theming for DrupalForensic Theming for Drupal
Forensic Theming for Drupal
 
Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend development
 

Plus de DrupalCamp Kyiv

Speed up the site building with Drupal's Bootstrap Layout Builder
Speed up the site building with Drupal's Bootstrap Layout BuilderSpeed up the site building with Drupal's Bootstrap Layout Builder
Speed up the site building with Drupal's Bootstrap Layout BuilderDrupalCamp Kyiv
 
Performance Monitoring with Google Lighthouse
Performance Monitoring with Google LighthousePerformance Monitoring with Google Lighthouse
Performance Monitoring with Google LighthouseDrupalCamp Kyiv
 
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...DrupalCamp Kyiv
 
Acquia BLT for the Win, or How to speed up the project setup, development an...
Acquia BLT for the Win, or  How to speed up the project setup, development an...Acquia BLT for the Win, or  How to speed up the project setup, development an...
Acquia BLT for the Win, or How to speed up the project setup, development an...DrupalCamp Kyiv
 
THE INTERNET OF THINGS IS GETTING REAL
THE INTERNET OF THINGS IS GETTING REALTHE INTERNET OF THINGS IS GETTING REAL
THE INTERNET OF THINGS IS GETTING REALDrupalCamp Kyiv
 
DRUPAL AND ELASTICSEARCH
DRUPAL AND ELASTICSEARCHDRUPAL AND ELASTICSEARCH
DRUPAL AND ELASTICSEARCHDrupalCamp Kyiv
 
WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...
WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...
WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...DrupalCamp Kyiv
 
DRUPAL 8 STORAGES OVERVIEW
DRUPAL 8 STORAGES OVERVIEWDRUPAL 8 STORAGES OVERVIEW
DRUPAL 8 STORAGES OVERVIEWDrupalCamp Kyiv
 
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICESONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICESDrupalCamp Kyiv
 
1-1 MEETING: STEP-BY-STEP-HOW-TO
1-1 MEETING: STEP-BY-STEP-HOW-TO1-1 MEETING: STEP-BY-STEP-HOW-TO
1-1 MEETING: STEP-BY-STEP-HOW-TODrupalCamp Kyiv
 
UX DURING MODULE INSTALLATION AND CONFIGURATION
UX DURING MODULE INSTALLATION AND CONFIGURATIONUX DURING MODULE INSTALLATION AND CONFIGURATION
UX DURING MODULE INSTALLATION AND CONFIGURATIONDrupalCamp Kyiv
 
SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?
SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?
SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?DrupalCamp Kyiv
 
TECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERA
TECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERATECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERA
TECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERADrupalCamp Kyiv
 
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPALPROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPALDrupalCamp Kyiv
 
DRUPAL AUDITS MADE FASTR
DRUPAL AUDITS MADE FASTRDRUPAL AUDITS MADE FASTR
DRUPAL AUDITS MADE FASTRDrupalCamp Kyiv
 
FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...
FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...
FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...DrupalCamp Kyiv
 
SEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONS
SEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONSSEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONS
SEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONSDrupalCamp Kyiv
 
DEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCE
DEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCEDEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCE
DEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCEDrupalCamp Kyiv
 

Plus de DrupalCamp Kyiv (20)

Speed up the site building with Drupal's Bootstrap Layout Builder
Speed up the site building with Drupal's Bootstrap Layout BuilderSpeed up the site building with Drupal's Bootstrap Layout Builder
Speed up the site building with Drupal's Bootstrap Layout Builder
 
Performance Monitoring with Google Lighthouse
Performance Monitoring with Google LighthousePerformance Monitoring with Google Lighthouse
Performance Monitoring with Google Lighthouse
 
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...
 
Acquia BLT for the Win, or How to speed up the project setup, development an...
Acquia BLT for the Win, or  How to speed up the project setup, development an...Acquia BLT for the Win, or  How to speed up the project setup, development an...
Acquia BLT for the Win, or How to speed up the project setup, development an...
 
Upgrading to Drupal 9
Upgrading to Drupal 9Upgrading to Drupal 9
Upgrading to Drupal 9
 
THE INTERNET OF THINGS IS GETTING REAL
THE INTERNET OF THINGS IS GETTING REALTHE INTERNET OF THINGS IS GETTING REAL
THE INTERNET OF THINGS IS GETTING REAL
 
DRUPAL AND ELASTICSEARCH
DRUPAL AND ELASTICSEARCHDRUPAL AND ELASTICSEARCH
DRUPAL AND ELASTICSEARCH
 
WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...
WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...
WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...
 
Blackfire Workshop
Blackfire WorkshopBlackfire Workshop
Blackfire Workshop
 
DRUPAL 8 STORAGES OVERVIEW
DRUPAL 8 STORAGES OVERVIEWDRUPAL 8 STORAGES OVERVIEW
DRUPAL 8 STORAGES OVERVIEW
 
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICESONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
 
1-1 MEETING: STEP-BY-STEP-HOW-TO
1-1 MEETING: STEP-BY-STEP-HOW-TO1-1 MEETING: STEP-BY-STEP-HOW-TO
1-1 MEETING: STEP-BY-STEP-HOW-TO
 
UX DURING MODULE INSTALLATION AND CONFIGURATION
UX DURING MODULE INSTALLATION AND CONFIGURATIONUX DURING MODULE INSTALLATION AND CONFIGURATION
UX DURING MODULE INSTALLATION AND CONFIGURATION
 
SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?
SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?
SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?
 
TECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERA
TECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERATECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERA
TECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERA
 
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPALPROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
 
DRUPAL AUDITS MADE FASTR
DRUPAL AUDITS MADE FASTRDRUPAL AUDITS MADE FASTR
DRUPAL AUDITS MADE FASTR
 
FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...
FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...
FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...
 
SEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONS
SEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONSSEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONS
SEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONS
 
DEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCE
DEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCEDEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCE
DEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCE
 

Dernier

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 

Dernier (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 

FRONT-END COMPONENTS IN DRUPAL THEME. "KAIZEN" - DRUPAL 8 THEME FROM SKILLD

  • 1. FRONT-END COMPONENTS IN DRUPAL THEME. "KAIZEN" - DRUPAL 8 THEME FROM SKILLD DRUPALCAMP KYIV'19
  • 2. Sergiy Borodylin Skilld - Drupal front-end developer DevCompany - Co-founder ● https://www.facebook.com/hog.seruj ● https://www.drupal.org/u/hog
  • 3. Problem with Implementation BEM components to Drupal render
  • 5. Patternlab ● Atoms ● Molecules ● Organisms ● Helpers ● Layouts BEM ● Block ● Element ● Modifier block-name__elem-name_mod-name_m od-val
  • 6. Block - main rules ● Block is fully independent ● Block can be placed in any place of the page ● Block shouldn't influence its environment, meaning you shouldn't set the external geometry (margin) or positioning for the block. ● You also shouldn't use CSS tag or ID selectors when using BEM.
  • 8. "scripts": { "build": "cross-env ./node_modules/.bin/webpack", "dev": "cross-env NODE_ENV=development ./node_modules/.bin/webpack --config webpack.config.dev.js", "debug": "cross-env NODE_ENV=debug ./node_modules/.bin/webpack --config webpack.config.dev.js", "lint": "cross-env ./node_modules/.bin/run-p lint:*", "lint-fix": "cross-env ./node_modules/.bin/run-p "lint:* --fix"", "lint:js": "node ./node_modules/eslint/bin/eslint.js .", "lint:css": "cross-env ./node_modules/.bin/stylelint "**/*.css"", "lint:sass": "cross-env ./node_modules/.bin/stylelint "**/*.scss" --config ./.stylelintrc.sass.json", "browsersync": "yarn run browser-sync start --proxy '127.0.0.1:8888' --files ./dist", "watch": "cross-env ./node_modules/.bin/webpack -w", "watch:bs": "cross-env NODE_ENV=development ./node_modules/.bin/run-p browsersync watch", "icons": "svg-sprite --config ./scripts/icons/svg-sprite.json ./images/svg/*.svg", "cc": "node ./scripts/create-component.js" } package.json
  • 9. webpack.config.js const glob = require('glob'); const path = require('path'); const TerserPlugin = require('terser-webpack-plugin'); const breakpointsImporter = require('./scripts/importers/breakpoints-importer'); const options = require('./kaizen-options'); const mapFilenamesToEntries = (pattern, globOptions) => glob.sync(pattern, globOptions).reduce((entries, filename) => { const [, name] = filename.match(/([^/]+) .scss$/); return { ...entries, [name]: filename, }; }, {});
  • 11. Stylelint replacing csslint in core - https://www.drupal.org/node/2868114 .stylelintrc.sass.json { "extends": [ "./.stylelintrc.json", "stylelint-config-recommended-scss" ], "rules": { "plugin/no-browser-hacks": null, "order/order": [ "custom-properties", "dollar-variables", { "type": "at-rule", "hasBlock": false },
  • 12. We create front-end components from console
  • 13. node ./scripts/create-component.js ? Please enter component name test_example ? What type of component? (Use arrow keys) ❯ Atom Molecule Organism Template Helper ? Create elements instead default COMPONENT__content? (y/N) ? (QUESTION PLACEHOLDER. NOT WORKING YET)Create record in *.libraries.yml? (y/N) ? Create twig template? (y/N) ? Enter element name content ? Want to enter another element (just hit enter for YES)? No
  • 14. @import '../../../init'; $name: 'a-test-example'; .#{$name}, %#{$name} { display: inherit; } <div class="a-test-example"> <div class"a-test-example__content">{{ content.content }}</div> </div> @import 'a-test-example'; // .DRUPAL-SELECTOR { // @extend %a-test-example; // }
  • 15. Module color and css vars
  • 16. :root { --color-1: #000; --color-2: #b9bab9; --color-3: #fff; --color-4: #37B480; --color-5: #52C998; --color-6: #353535; --color-7: #1b1464; } :root { --color-bg: var(--color-7); --color-text: var(--color-6); --color-link: var(--color-3); --color-link--hover: var(--color-4); }
  • 18. theme_name.breakpoints.yml theme_name.mobile: label: mobile mediaQuery: 'all and (max-width: 639px)' weight: 0 group: name multipliers: - 1x - 2x theme_name.narrow: label: narrow mediaQuery: 'all and (min-width: 640px) and (max-width: 1023px)' weight: 1 group: name multipliers: - 1x - 2x theme_name.wide: label: wide mediaQuery: 'all and (min-width: 1024px)' weight: 2 group: name multipliers: - 1x - 2x @include respond-to(wide_1x) {}
  • 19. Migrate from scss to post css - causes and disadvantages
  • 20. Done ● Removed sass and its dependencies. ● Moved variables to custom css props. ● Added nested plugin to make css sass like ● Added import plugin ● Added drupal custom plugin breakpoints ● Added test examples of variables/colors/breakpoints/components/nested Things to do ● Fix linter issues After compiling. ● Rework create component task ● Check watcher and other tasks. ● Test with docker. ● Check sourcemaps generation
  • 21.
  • 22. No jQuery. ES6 You don’t need jQuery
  • 24.
  • 25.
  • 26. theme_name.components.yml info-box: label: Info Box type: twig description: Info Box group: 02 Theme Molecules content: items: - <div class="m-info-box__field-wrapper"><div class="m-info-box__field-title">Field title</div><div class="m-info-box__field-content">Field content</div></div> - <div class="m-info-box__field-wrapper"><div class="m-info-box__field-title">Field title</div><div class="m-info-box__field-content">Field content</div></div> - <div class="m-info-box__field-wrapper"><div class="m-info-box__field-title">Field title</div><div class="m-info-box__field-content">Field content</div></div> - <div class="m-info-box__field-wrapper"><div class="m-info-box__field-title">Field title</div><div class="m-info-box__field-content">Field content</div></div> modifiers: background-one: m-info-box__title--background-1 template: /src/sass/components/molecules/info-box/m-info-box.twig
  • 27. Theme for developer VS theme for customer