我正在从 Extjs 4.2 迁移到 Extjs 6.2。我曾经在头部包含一个自定义 css 文件,并在包含 Extjs 之后放置一个简单的链接。
<link rel="stylesheet" href="/custom.css" type="text/css" charset="utf-8" />
Run Code Online (Sandbox Code Playgroud)
这不再起作用,因为 Extjs 6 加载其 css 文件的方式。它们在头部末端注射。
那么如何在 ExtJs 6 中包含自定义 css 文件以覆盖内置规则?
编辑:是的,这个问题已经有了一些答案,但是
/sf/answers/1762376241/提供了一些链接,归结为:
将文件 custom.css 复制到 /packages/local/custom-theme/sass/etc
@import 'custom.scss'到all.scss到目前为止一切顺利,但是:
sass/etc文件夹在所有其他样式之前加载小智 6
该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
}
},
Run Code Online (Sandbox Code Playgroud)