如何在 Extjs 6 中包含自定义 css?

Lor*_*yer 2 css extjs extjs6

我正在从 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 文件以覆盖内置规则?

编辑:是的,这个问题已经有了一些答案,但是

到目前为止一切顺利,但是:

  • 根据文档,该sass/etc文件夹所有其他样式之前加载
  • 我的自定义样式表的内容没有通过所有构建机制,也不想显示在我的 `build/production/[appname]/resources/[appname]-all.css 中

小智 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)