1. Cài đặt drush
Dùng drush để cài đặt bootstrap 3 và jquery_update hoặc bạn có thể down về và cài.
drush en bootstrap jquery_update
2. copy sass (mình dùng sass) trong ../sites/all/themes/bootstrap/starterkits/sass tới ../sites/all/themes/
cp ../sites/all/themes/bootstrap/starterkits/sass ../sites/all/themes/
3. Đổi tên sass thanh tên subtheme bạn muốn. ví dụ my_subtheme
mv ../sites/all/themes/sass ../sites/all/themes/my_subtheme
4. Đổi tên sass.starterkits thành my_subtheme.info
5. Download bootstrap framework mới nhất tại đây
https://getbootstrap.com/docs/3.3/ mình down bản 3.3.7
Trong file download có dist, js ...
6. Bạn copy dist tới ( dist có chứa 3 folder css, fonts, js)
../sites/all/themes/my_subtheme và đổi tên folder dist thành bootstrap
7. Copy thư viện js trong trong js framework vào js trong bootstrap
8. Sửa file my_subtheme.info như bên dưới
name = 'my_subtheme'
description = SubTheme sass.
core = 7.x
base theme = bootstrap
;;;;;;;;;;;;;;;;;;;;;
;; Regions
;;;;;;;;;;;;;;;;;;;;;
regions[navigation] = 'Navigation'
regions[header] = 'Top Bar'
regions[highlighted] = 'Highlighted'
regions[help] = 'Help'
regions[content] = 'Content'
regions[sidebar_first] = 'Primary'
regions[sidebar_second] = 'Secondary'
regions[footer] = 'Footer'
regions[page_top] = 'Page top'
regions[page_bottom] = 'Page bottom'
;;;;;;;;;;;;;;;;;;;;;
;; Stylesheets
;;;;;;;;;;;;;;;;;;;;;
stylesheets[all][] = css/style.css
stylesheets[all][] = bootstrap/css/bootstrap.css
;;;;;;;;;;;;;;;;;;;;;
;; Scripts
;;;;;;;;;;;;;;;;;;;;;
scripts[] = 'bootstrap/js/bootstrap.min.js'
scripts[] = 'bootstrap/js/affix.js'
scripts[] = 'bootstrap/js/alert.js'
scripts[] = 'bootstrap/js/button.js'
scripts[] = 'bootstrap/js/carousel.js'
scripts[] = 'bootstrap/js/collapse.js'
scripts[] = 'bootstrap/js/dropdown.js'
scripts[] = 'bootstrap/js/modal.js'
scripts[] = 'bootstrap/js/tooltip.js'
scripts[] = 'bootstrap/js/popover.js'
scripts[] = 'bootstrap/js/scrollspy.js'
scripts[] = 'bootstrap/js/tab.js'
scripts[] = 'bootstrap/js/transition.js'
; Disable the CDN provider so compiled source files can be used.
settings[bootstrap_cdn] = ''
9. Vào quản trị site http://localhost/drupal7/admin/appearance (theo đường dẫn bạn cài)
Chọn enable and set default
Vậy là hoàn thành tạo subtheme bản bootstrap 3.3.7
Vẫn còn khá nhiều vấn đề nữa để viết ví dụ như sử dụng sass thế nào với bootstrap trên window có thời gian mình sẽ viết tiếp sau.
Thanks.
- Log in to post comments