Home > Web Front-end > HTML Tutorial > Less Development Guide (3) - Code File Tracking and Debugging_html/css_WEB-ITnose

Less Development Guide (3) - Code File Tracking and Debugging_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:04:23
Original
1182 people have browsed it

Case background: In large websites, css styles are divided into multiple module files, such as reset.css, layout.css, skin.css, etc. (the smaller the granularity, the better the style The higher the reuse rate), just introduce them when the page needs them!

Back in the less project, we can also divide it into reset.less, layout.less, skin.less, etc., and then embed it in the style of this page (such as index.less) They (the embedded method reduces multiple HTTP requests, the performance is relatively good, and can also be understood as a combination), the code is as follows:

index.less

@import 'block/reset.less';@import 'block/layout.less';@import 'block/unit.less';
Copy after login

reset.less

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {    margin:0;padding:0;}
Copy after login

layout.less

.main{width:1000px;margin:0 auto;}
Copy after login

unit.less

.tips{background:#eee;color:#f60;}
Copy after login

Then the page introduces the compiled index.css file

index.html

<!doctype html><html lang="en"><head>    <meta charset="UTF-8">    <title>Document</title>    <link rel="stylesheet" href="css/index.css"></head><body>    <div class="main">        <div class="tips">tips</div>    </div></body></html>
Copy after login

Then, when debugging the .tips style, the problem arises, how do I know it? Which module's style file does it belong to? The key point is to use the generated source map to track code files

(1) How to generate it? Take the Koala software as an example:

Check and select, an index.css.map file will be generated

(2 ) Open the page in Google Chrome, press F12, point to the .tips style, and find that it has been tracked into the unit.less module file

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template