CSS源地图中的换行符

时间:2015-05-26 21:59:09

标签: css google-chrome less

我有一些LESS,在选择器之间用空格格式化,在新行上用大括号格式化。

body {
    background-color: #3a3a3a;
    font-family:Verdana;
}

header
{
    background-color: rgba(40, 40, 40, 0.7);
    position: relative;
    z-index: 100; 
}

#companyLogo
{
    margin-top:15px;
    margin-bottom:10px; 
    margin-left:10px; 
}

当您通过chrome调试器查看较少的内容时,它会以不同的间距显示,这会使行号停止。

body {
  background-color: #3a3a3a;
  font-family: Verdana;
}
header {
  background-color: rgba(40, 40, 40, 0.7);
  position: relative;
  z-index: 100;
}
#companyLogo {
  margin-top: 15px;
  margin-bottom: 10px;
  margin-left: 10px;
}

这是我用来构建less

的Gruntfile.js
module.exports = function (grunt) {
    grunt.initConfig({
        watch: {
            less: {
                files: ["css/*.less"],
                tasks: ["less"],
                options: {
                    livereload: true,
                }
            }
        },
        less: {
            development: {
                options: {
                    sourceMap: true,
                    //sourceMapFileInline: true,
                    sourceMapBasepath: "css/",
                    sourceMapURL: "style.css.map",
                    sourceMapFilename: "css/style.css.map"
                },
                files: {
                    "css/style.css": "css/style.less"
                }
            },
            compressed:
            {
                options: {
                    sourceMap: true,
                    //sourceMapFileInline: true,
                    compress: true,
                    sourceMapBasepath: "css/",
                    sourceMapURL: "style.min.css.map",
                    sourceMapFilename: "css/style.min.css.map"
                },
                files: {
                    "css/style.min.css": "css/style.less"
                }
            }
        }
    });

    // The following line loads the grunt plugins.
    grunt.loadNpmTasks("grunt-contrib-less");
    grunt.loadNpmTasks("grunt-contrib-watch");
};

这有什么办法吗?

在css中工作时,不得不在选择器上执行查找而不是直接行到它。

1 个答案:

答案 0 :(得分:0)

我现在要解决的问题是格式化less以匹配chrome期望与选择器在同一行上的开括号。