This repository has been archived by the owner on Oct 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.theme-build.zsh.inc
61 lines (58 loc) · 1.81 KB
/
.theme-build.zsh.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Drupal theme watch/build with gulp
#
# get drupal version:
# drush st --format=list drupal-version
#
# Drupal 8, get theme name:
# drush cget system.theme default --format=string
#
# Drupal 8, get theme path:
# drush dd $(drush cget system.theme default --format=string)
#
# Drupal 8, run gulp:
# (cd $(drush dd $(drush cget system.theme default --format=string)) && gulp)
# or:
# gulp --cwd $(drush dd $(drush cget system.theme default --format=string))
#
# Drupal 8, run gulp build:
# (cd $(drush dd $(drush cget system.theme default --format=string)) && gulp build)
# or:
# gulp build --cwd $(drush dd $(drush cget system.theme default --format=string))
#
# Drupal 7, get theme name:
# drush vget theme_default --format=string
#
# Drupal 7, get theme path:
# drush dd $(drush vget theme_default --format=string)
#
# Drupal 7, run gulp:
# (cd $(drush dd $(drush vget theme_default --format=string)) && gulp)
# or:
# gulp --cwd $(drush dd $(drush vget theme_default --format=string))
#
# Drupal 7, run gulp:
# (cd $(drush dd $(drush vget theme_default --format=string)) && gulp build)
# or:
# gulp build --cwd $(drush dd $(drush vget theme_default --format=string))
#
# Zsh function:
function dtw() {
v=$(drush st --format=list drupal-version)
if [ ${v%%.*} -eq 8 ]; then
gulp --cwd $(drush dd $(drush cget system.theme default --format=string))
elif [ ${v%%.*} -eq 7 ]; then
gulp --cwd $(drush dd $(drush vget theme_default --format=string))
else
echo "Unsupported Drupal version";
fi
}
function dtb() {
v=$(drush st --format=list drupal-version)
if [ ${v%%.*} -eq 8 ]; then
gulp build --cwd $(drush dd $(drush cget system.theme default --format=string))
elif [ ${v%%.*} -eq 7 ]; then
gulp build --cwd $(drush dd $(drush vget theme_default --format=string))
else
echo "Unsupported Drupal version";
fi
}