leo @file 沒有指定 @language 導(dǎo)致瀏覽器無法解釋 css 注釋

為了避免 .leo 文件改變而影響外部文件在 leo-editor 中的的導(dǎo)入顯示,我批量替換 @clean 為 @file.
但是卻引發(fā)了 css 文件注釋格式不對,從而瀏覽器無法加載 css 文件的問題。因?yàn)槟J(rèn) @file 使用了網(wǎng)頁的注釋語法, 用 # 作為注釋; 但是 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-->

在調(diào)試時(shí) chromium 的 console 中沒有顯示錯(cuò)誤信息,后來使用 Firefox 自帶的 F12 調(diào)試才顯示了錯(cuò)誤如下:

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 就可以了。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容