Amitai Burstein chia sẻ cách làm theming trong Drupal 7

Amitai Burstein chia sẻ cách làm theming trong Drupal 7

Treat your custom CSS as contrib

Getting your Drupal to be pixel perfect is hard. In fact, it's probably four times faster to write the logic of a page, in comparison to the time it takes to get it's markup right. Not to talk about making it responsive.

If you've seen my presentation about The Gizra Way you noticed we take pixel perfect very seriously.

One of the tools that helps us getting the markup fast, correct and in a way that would allow us to communicate with the client is Jekyll - the static site generator. Here's the idea in a nutshell:

  • Using Jekyll we can concentrate on a clean markup
  • Using Grunt we compile the SASS, and are able to push the the HTML into Github pages - where the client can easily see and interact with the final markup
  • The CSS produced by Jekyll is treated by our Drupal application as contrib. This means we have zero custom CSS in our theme. Seriously, absolutely no custom CSS in your Drupal theme!
  • Any change to the CSS can be done only in a single place, which is Jekyll

Implementation details

We use a great yo generator to build a Jekyll directory in our installation profile (obviously each project in Gizra is built as an installation profile). Here's an example of our Gruntfile.js. Note that if you are gonig to use Bootstrap, it still does't come out of the box, so you'll need to do somemanual work to set it up.

Our team can now work on the markup. Once the markup changes we can grunt deploy -- and the markup will be pushed to Github pages, to facilitate all the stake holders to validate the design and responsiveness of the site.

Next, when the team will work on the Drupal site, instead of coping the CSS into the Drupal theme itself, we copy it into libraries/custom (where "custom" could be your site's name). This means your CSS is edited only in a single place, which is the Jekyll app. Since this is a repetitive task we have automated it with a simple bash script.

Last step - given our custom theme is under profiles/[profile-name]/themes/custom/subtheme- is to load the "contrib" CSS via the theme's info file:

stylesheets[all][] = '../../../libraries/custom/css/main.css'

Finally, the developers can now enjoy working on a pixel perfect template where they only need to yank out the static parts and replace it with the dynamic content, so visually the site never looks broken, and logic is added to it incrementally.

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Thiết kế website theo chuẩn smartphone, mobile

Thiết kế website theo chuẩn smartphone, mobile

Bài viết giới thiệu dịch vụ thiết kế website theo chuẩn Mobile ( điện thoại di động ) - Xu hướng mới của dịch vụ web.

Error

Những lỗi thường gặp của Keyword Research

Sau nhiều tháng ngày làm SEO vất vả và cuối cùng thì không đạt được những gì mình mong muốn. Sẽ có nhiều câu hỏi đặt ra, vì sao giá click của tôi quá thấp, vì sao tôi đã ở Top 1 nhưng quá ít visit ?

Hướng dẫn cài đặt Phalcon trực tiếp trên Mac

Hướng dẫn cài đặt Phalcon trực tiếp trên Mac

Hôm nay tôi hướng dẫn các bạn cài đặt Phalcon trực tiếp trên Mac OSX để lập trình.

Công ty diệt chuột T&C

 

Diet con trung