SlideShare a Scribd company logo
1 of 13
CREATING DRUPAL 8
THEME WITH NODE.JS
LIBSASS, GULP &
BROWSERSYNC
Hello!
MY NAME IS ANDREI
I am a Front End Developer at Appnovation
Find me at: @zetagraph
Drupal 8
Time to explore and start adopting
8.0.0-beta4
D8 & FE TOOLS
Using node.js & gulp.js in theming workflow
PORTICO
Internal Project. An annual competition for technology
focused post secondary students
Place your screenshot here
D8 THEME STRUCTURE
○ .info.yml - file
○ .libraries.yml - file
○ .theme - file
○ scss - partials structure
○ package.json
○ node_modules
○ gulpfile.js
NODE.JS
○ brew install node
○ npm init - create package.json
○ npm install
○ fetch node modules - gulp, gulp-sass, etc
○ add node_modules to .gitignore
GULPFILE.JS
○ require dependencies
○ tasks for sass, js, img, twig, browsersync
○ gulp it to compile, watch & browsersync
BROWSERSYNC
BrowserSync is similar to Livereload, however it helps
you test your site on multiple devices over a shared
network by synchronising URLs, interactions and code
changes across multiple devices. It’s wicked-fast and
totally free.
ADDING JS AND CSS ASSETS TO A
DRUPAL 8 THEME
○ Deleting or overriding existing styles served by core
○ Declaring dependencies
○ Specifying scope of a JS (footer)
○ Specifying media type
○ Conditional CSS or JS for older IE browsers
○ Bringing in an external JS or CSS resource
○ Adding or limiting a library to specific pages
DEBUGGING TOOLS IN D8
Get template file name suggestions by enabling debug.
○ In D8 set "debug: true" in sites/default/services.yml
while developing
○ In D7 (7.33) add $conf['theme_debug'] = TRUE;
to settings.php
SOURCE
CODE
Example theme source code:
github.com/zetagraph/monoset
THANKS!
Questions?
Connect:
twitter & github: @zetagraph
blog: appnovation.com/blogs/azvonkov
email: andrei@appnovation.com

More Related Content

Similar to Creating a drupal 8 theme with node.js, libsass, gulp & browsersync

Similar to Creating a drupal 8 theme with node.js, libsass, gulp & browsersync (20)

1. react - native: setup
1. react - native: setup1. react - native: setup
1. react - native: setup
 
Docker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, BonnDocker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, Bonn
 
Introduction to new technologies in drupal 8
Introduction to new technologies in drupal 8Introduction to new technologies in drupal 8
Introduction to new technologies in drupal 8
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and Drush
 
The Self-Service Developer - GOTOCon CPH
The Self-Service Developer - GOTOCon CPHThe Self-Service Developer - GOTOCon CPH
The Self-Service Developer - GOTOCon CPH
 
React Django Presentation
React Django PresentationReact Django Presentation
React Django Presentation
 
CoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copyCoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copy
 
Overview of Node JS
Overview of Node JSOverview of Node JS
Overview of Node JS
 
Drupal + composer = new love !?
Drupal + composer = new love !?Drupal + composer = new love !?
Drupal + composer = new love !?
 
Building Websites of the Future With Drupal 7
Building Websites of the Future With Drupal 7Building Websites of the Future With Drupal 7
Building Websites of the Future With Drupal 7
 
Building Websites of the Future With Drupal 7
Building Websites of the Future With Drupal 7Building Websites of the Future With Drupal 7
Building Websites of the Future With Drupal 7
 
Welcome aboard the team
Welcome aboard the teamWelcome aboard the team
Welcome aboard the team
 
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
 
Decoupled drupal
Decoupled drupal Decoupled drupal
Decoupled drupal
 
Drupalcampatl d7
Drupalcampatl d7Drupalcampatl d7
Drupalcampatl d7
 
Nuxeo Roadmap June 2012
Nuxeo Roadmap June 2012Nuxeo Roadmap June 2012
Nuxeo Roadmap June 2012
 
Drupal south 2014 - bootstrap vs foundation deathmatch - v.1.1
Drupal south 2014 - bootstrap vs foundation deathmatch - v.1.1Drupal south 2014 - bootstrap vs foundation deathmatch - v.1.1
Drupal south 2014 - bootstrap vs foundation deathmatch - v.1.1
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
 
Making The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To SwallowMaking The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To Swallow
 
DEEP: a user success story
DEEP: a user success storyDEEP: a user success story
DEEP: a user success story
 

Creating a drupal 8 theme with node.js, libsass, gulp & browsersync

  • 1. CREATING DRUPAL 8 THEME WITH NODE.JS LIBSASS, GULP & BROWSERSYNC
  • 2. Hello! MY NAME IS ANDREI I am a Front End Developer at Appnovation Find me at: @zetagraph
  • 3. Drupal 8 Time to explore and start adopting 8.0.0-beta4
  • 4. D8 & FE TOOLS Using node.js & gulp.js in theming workflow
  • 5. PORTICO Internal Project. An annual competition for technology focused post secondary students Place your screenshot here
  • 6. D8 THEME STRUCTURE ○ .info.yml - file ○ .libraries.yml - file ○ .theme - file ○ scss - partials structure ○ package.json ○ node_modules ○ gulpfile.js
  • 7. NODE.JS ○ brew install node ○ npm init - create package.json ○ npm install ○ fetch node modules - gulp, gulp-sass, etc ○ add node_modules to .gitignore
  • 8. GULPFILE.JS ○ require dependencies ○ tasks for sass, js, img, twig, browsersync ○ gulp it to compile, watch & browsersync
  • 9. BROWSERSYNC BrowserSync is similar to Livereload, however it helps you test your site on multiple devices over a shared network by synchronising URLs, interactions and code changes across multiple devices. It’s wicked-fast and totally free.
  • 10. ADDING JS AND CSS ASSETS TO A DRUPAL 8 THEME ○ Deleting or overriding existing styles served by core ○ Declaring dependencies ○ Specifying scope of a JS (footer) ○ Specifying media type ○ Conditional CSS or JS for older IE browsers ○ Bringing in an external JS or CSS resource ○ Adding or limiting a library to specific pages
  • 11. DEBUGGING TOOLS IN D8 Get template file name suggestions by enabling debug. ○ In D8 set "debug: true" in sites/default/services.yml while developing ○ In D7 (7.33) add $conf['theme_debug'] = TRUE; to settings.php
  • 12. SOURCE CODE Example theme source code: github.com/zetagraph/monoset
  • 13. THANKS! Questions? Connect: twitter & github: @zetagraph blog: appnovation.com/blogs/azvonkov email: andrei@appnovation.com

Editor's Notes

  1. Global Sprint Weekend is coming to a city near you on January 17th
  2. Using Bundler
  3. Explore core themes Classy - remove classes from core
  4. npm install gulp -g npm install gulp --save-dev
  5. Setup tasks to watch & compile sass, js, img, twig, browsersync
  6. Template will be surrounded by HTML comments. Twig templates are automatically recompiled whenever the source code changes (see auto_reload below). Check out core for structure and examples