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

时间:2016-11-04 14:44:33

标签: css extjs extjs6

我正在从Extjs 4.2迁移到Extjs 6.2。 我曾经在头部包含一个自定义的css文件,在包含Extjs之后放置了一个简单的链接。

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

由于Extjs 6加载其css文件的方式,这不再起作用了。它们是在头部注射的。

那么如何在ExtJs 6中包含自定义css文件以覆盖内置规则?

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

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

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

1 个答案:

答案 0 :(得分:4)

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
    }
},