daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Drupal theme watch/build with gulp
  2. #
  3. # get drupal version:
  4. # drush st --format=list drupal-version
  5. #
  6. # Drupal 8, get theme name:
  7. # drush cget system.theme default --format=string
  8. #
  9. # Drupal 8, get theme path:
  10. # drush dd $(drush cget system.theme default --format=string)
  11. #
  12. # Drupal 8, run gulp:
  13. # (cd $(drush dd $(drush cget system.theme default --format=string)) && gulp)
  14. # or:
  15. # gulp --cwd $(drush dd $(drush cget system.theme default --format=string))
  16. #
  17. # Drupal 8, run gulp build:
  18. # (cd $(drush dd $(drush cget system.theme default --format=string)) && gulp build)
  19. # or:
  20. # gulp build --cwd $(drush dd $(drush cget system.theme default --format=string))
  21. #
  22. # Drupal 7, get theme name:
  23. # drush vget theme_default --format=string
  24. #
  25. # Drupal 7, get theme path:
  26. # drush dd $(drush vget theme_default --format=string)
  27. #
  28. # Drupal 7, run gulp:
  29. # (cd $(drush dd $(drush vget theme_default --format=string)) && gulp)
  30. # or:
  31. # gulp --cwd $(drush dd $(drush vget theme_default --format=string))
  32. #
  33. # Drupal 7, run gulp:
  34. # (cd $(drush dd $(drush vget theme_default --format=string)) && gulp build)
  35. # or:
  36. # gulp build --cwd $(drush dd $(drush vget theme_default --format=string))
  37. #
  38. # Zsh function:
  39.  
  40. function dtw() {
  41.   v=$(drush st --format=list drupal-version)
  42.   if [ ${v%%.*} -eq 8 ]; then
  43.     gulp --cwd $(drush dd $(drush cget system.theme default --format=string))
  44.   elif [ ${v%%.*} -eq 7 ]; then
  45.     gulp --cwd $(drush dd $(drush vget theme_default --format=string))
  46.   else
  47.     echo "Unsupported Drupal version";
  48.   fi
  49. }
  50.  
  51. function dtb() {
  52.   v=$(drush st --format=list drupal-version)
  53.   if [ ${v%%.*} -eq 8 ]; then
  54.     gulp build --cwd $(drush dd $(drush cget system.theme default --format=string))
  55.   elif [ ${v%%.*} -eq 7 ]; then
  56.     gulp build --cwd $(drush dd $(drush vget theme_default --format=string))
  57.   else
  58.     echo "Unsupported Drupal version";
  59.   fi
  60. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top