Giới thiệu 5 Tips để debug Drupal front-end với Chrome DevTools

Giới thiệu 5 Tips để debug Drupal front-end với Chrome DevTools

5 of my favourite keyboard shortcuts in Chrome DevTools. I used them all the time to find bugs in JS, HTML and CSS

Giới thiệu 5 Tips để debug Drupal front-end với Chrome DevTools

1. CMD + ALT + F.  (Windows/Linux: CTRL + SHIFT + F)

A global search. Search in every asset HTML,CSS and JS.  Useful when you want to check if the browser is loading the changes you are doing, or to find something in the JavaScript code to place a breakpoint. Specially useful in production, when JavaScript files are aggregated, don't try to find the code manually. Use the global search.

alt_cmd.gif

2. CMD + Z (Windows/Linux: CTRL + Z)

Yes, the traditional 'undo' command. Did you know you can undo the CSS changes in DevTools?

ctrl_z.gif

3. CMD + S (Windows/Linux: CTRL + S)

Edit the JavaScript files inside DevTools (Source Tab). Then save the changes (CMD + S) . You will see in the console "Recompilation and update succeeded." and the background color will change.  This trick is not very useful alone. But you can use it while debugging with breakpoints.  This tip is really useful to debug on-the-fly in production sites.

breakpoint.gif

4. ALT + Click  (Windows/Linux: CTRL + ALT + Click)

This trick is awesome for severe cases of HTML divitis. Press ALT and click at the same time on the arrow, it will expand all their children.

alt_expand.gif

5. debugger;

This is not a keyboard shortcut. It's a statement defined ECMAScript 5, so it works in all modern browsers. Place the string debugger in your JavaScript code, and it will have the same effect than a breakpoint, halting JavaScript execution and opening the browser's debugger.

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

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

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

 

David Baker chia sẻ 11 suy nghĩ cần thiết cho Drupal team

There was an article by David Baker that caught my attention. David is a long-time consultant for the web agency marketplace who offers blunt

Nguyễn Thành Nhân - người Việt trẻ thành danh ở Google

Nguyễn Thành Nhân - người Việt trẻ thành danh ở Google

Ở thung lũng công nghệ cao Silicon, Mỹ có nhiều người Việt Nam trẻ tuổi đang làm việc cho tập đoàn công nghệ hàng đầu thế giới - Google. Họ đang thành công với công việc của mình ở xứ người, nhưng vẫn ấp ủ ngày trở về.

Hiển thị thứ hạng Alexa cho website Drupal bằng module Alexa4drupal

Hiển thị thứ hạng Alexa cho website Drupal bằng module Alexa4drupal

Trong bài viết Thêm sắc màu cho web site Joomla! của bạn (Phần 1) đã có giới thiệu về cách sử dụng My Alexa Data để có thể hiện thị thứ hạng của Alexa cho website trên Joomla! nhưng hôm nay chúng tôi sẽ giới thiệu cách hiện thị thứ hạng Alexa trên một website bằng Drupal (giống như giao diện mới hiện tại của thông tin công nghệ được xây dựng trên Drupal).

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

 

Diet con trung