2016-11-04 37 views
1

我正在從Extjs 4.2遷移到Extjs 6.2。 我曾經在包含Extjs之後放置一個簡單的鏈接在頭部包含一個自定義的css文件。如何在Extjs 6中包含自定義css?

<link rel="stylesheet" href="/custom.css" type="text/css" charset="utf-8" /> 

由於Extjs 6加載其css文件的方式,這不起作用。他們被注射在頭部的末端。

那麼如何在ExtJs 6中包含自定義css文件以覆蓋內置規則?

編輯:是的,已經有一些這個問題的答案,但

到目前爲止好,但:

  • 根據該文件,該sass/etc文件夾之前所有其他樣式
  • 我的自定義樣式表的內容只是沒有得到加載通過所有的構建機器,並不想出現在我的`構建/生產/ [appname] /資源/ [appname] -all.css

回答

1

app.json文件是外部css文件的一部分。 如果該部分不存在,您可以創建它。 在sencha構建之後,加載了css文件。

/** 
* List of all CSS assets in the right inclusion order. 
* 
* Each item is an object with the following format: 
* 
*  { 
*   // Path to file. If the file is local this must be a relative path from 
*   // this app.json file. 
*   // 
*   "path": "path/to/stylesheet.css", // REQUIRED 
* 
*   // Specify as true if this file is remote and should not be copied into the 
*   // build folder. Defaults to false for a local file which will be copied. 
*   // 
*   "remote": false, // OPTIONAL 
* 
*   // If not specified, this file will only be loaded once, and cached inside 
*   // localStorage until this value is changed. You can specify: 
*   // 
*   // - "delta" to enable over-the-air delta update for this file 
*   // - "full" means full update will be made when this file changes 
*   // 
*   "update": ""  // OPTIONAL 
*  } 
*/ 
"css": [ 
    { 
     "path": "bootstrap.css", 
     "bootstrap": true 
    }, 
    { 
     "path": "custom.css" 
    } 
], 

"output": { 
    "page": { 
     "path": "index.html" 
    }, 
    "manifest": { 
     "embed": true 
    } 
}, 
+0

非常感謝!這只是一個非常簡單的方法,可以定義加載資源的順序。 –