我在我的Ext JS包的資源/ css目錄中有一個CSS文件。儘管如此package-all.css在sencha package build
之後爲空。Ext JS代碼包:包含資源/ css/* .css包構建
如何讓Sencha將CSS文件的內容放入package-all.css?它應該最終被複制到使用該軟件包的應用程序的all.css文件中。
我在我的Ext JS包的資源/ css目錄中有一個CSS文件。儘管如此package-all.css在sencha package build
之後爲空。Ext JS代碼包:包含資源/ css/* .css包構建
如何讓Sencha將CSS文件的內容放入package-all.css?它應該最終被複制到使用該軟件包的應用程序的all.css文件中。
您必須將其添加到package.json
作爲資源。
/**
* Extra resources to be copied along when build
*/
"resources": [
"resources/css/app.css",
"resources/images",
"resources/static",
"resources/libs",
"resources/translations"
],
甚至更好的一個css文件。
/**
* List of all CSS assets in the right inclusion order.
* Each item is an object with the following format:
* {
* "path": "path/to/item.css" // Path to file, if local file it must be relative to this app.json file
* "remote": true // (Optional)
* // - Defaults to undefined (falsey) to signal a local file which will be copied
* // - Specify true if this file is a remote file which will not to be copied
* "update": "delta" // (Optional)
* // - If not specified, this file will only be loaded once, and
* // cached inside localStorage until this value is changed to either one below
* // - "delta" to enable over-the-air delta update for this file
* // - "full" means full update will be made when this file changes
*
* }
*/
"css": [
{
"path": "resources/libs/Arcgis v3.11/arcgis311.css",
"remote": true
},
{
"path": "resources/css/app.css",
"remote": true
}
]
您可以直接將它包含在index.html中。在構建其工作細如well.`
<title>xxxxx</title>
<!-- The line below must be kept intact for Sencha Cmd to build your application -->
<link type='text/css' rel='stylesheet' href='resources/custom/css/my_css.css' />
<link type='text/css' rel='stylesheet' href='resources/fonts/font-awesome-4.3.0/css/font-awesome.css' />
<script id="microloader" type="text/javascript" src="bootstrap.js"></script>
`
Sencha的最佳做法是不編輯index.html文件,因爲它是在構建過程中重新生成的。 Sencha甚至將它置入評論中,你所做的就是忽略評論,只需添加自己的代碼行。 – Tarabass
通過Tarabass的回答啓發,我將我的CSS文件中的package.json包裏面。現在它被應用程序使用。
"css": [{
path: "resources/css/styles.css"
}],
忘記了叫'package.json'而不是'app.json'。我將編輯我的答案,以便更加精確地爲將來要完成相同的用戶。 – Tarabass
將它添加到加載的** - all.css *文件不是更有意義嗎? – ideaboxer