leo @file 没有指定 @language 导致浏览器无法

2017-10-01  本文已影响0人  swotpp

为了避免 .leo 文件改变而影响外部文件在 leo-editor 中的的导入显示,我批量替换 @clean 为 @file.
但是却引发了 css 文件注释格式不对,从而浏览器无法加载 css 文件的问题。因为默认 @file 使用了网页的注释语法, 用 # 作为注释; 但是 css 使用 /* */ 作为注释。举例如下:

    <!--@+leo-ver=5-thin-->
    <!--@+node:swot.20161124181624.1: * @file joyself.css-->
    
    .f-user-add {
        background: url("/static/xteller/xteller2/jinjian/add_img.png") no-repeat 0 0;
        background-size: 100% 100%;
        width: 45px;
        height: 45px;
    }
    
    .picleft ul {
        list-style: none;
    }
    
    .picleft li {
        float: left;
    }
    
    img{
        color: red;
    }
    <!--@-leo-->

在调试时 chromium 的 console 中没有显示错误信息,后来使用 Firefox 自带的 F12 调试才显示了错误如下:

22:57:12.011 Selector expected. Ruleset ignored due to bad selector. joyself.css:1:4

22:57:12.011 Unexpected end of file while searching for end of at-rule. joyself.css:24

下面是 leo 文档中对 @file 和 @clean 的一些描述。

When writing file trees, Leo writes sentinel comments into external files. These comments represent outline structure. When writing an @file tree to a .leo file, Leo writes only the root @file node. To avoid sentinels, use @clean instead of @file::

    @clean leoNodes.py
    @clean ../../notes.txt

There is a small cost to @clean: Leo saves the entire @clean tree in the .leo file.

在 css 文件中 指定 @language css 就可以了。

上一篇下一篇

猜你喜欢

热点阅读