mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 17:33:23 +00:00
[Stylesheets] Add style sheet loader
Add style sheet loader and move style sheets inclusion out of index.html. WTD-591.
This commit is contained in:
parent
04ee5bbbb5
commit
fcab62b498
17
index.html
17
index.html
@ -3,23 +3,6 @@
|
||||
<head lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
|
||||
<link rel="stylesheet"
|
||||
type="text/css",
|
||||
href="platform/commonUI/general/res/css/normalize.min.css">
|
||||
|
||||
<link rel="stylesheet"
|
||||
type="text/css",
|
||||
href="platform/commonUI/general/res/css/theme-espresso.css">
|
||||
|
||||
<link rel="stylesheet"
|
||||
type="text/css",
|
||||
href="platform/commonUI/general/res/css/items.css">
|
||||
|
||||
<link rel="stylesheet"
|
||||
type="text/css",
|
||||
href="platform/commonUI/general/res/css/tree.css">
|
||||
|
||||
<script type="text/javascript"
|
||||
src="platform/framework/lib/require.js"
|
||||
data-main="platform/framework/src/Main.js">
|
||||
|
@ -3,6 +3,30 @@
|
||||
"description": "General UI elements, meant to be reused across modes.",
|
||||
"resources": "res",
|
||||
"extensions": {
|
||||
"runs": [
|
||||
{
|
||||
"implementation": "StyleSheetLoader.js",
|
||||
"depends": [ "stylesheets[]", "$document" ]
|
||||
}
|
||||
],
|
||||
"stylesheets": [
|
||||
{
|
||||
"stylesheetUrl": "css/normalize.min.css",
|
||||
"priority": "mandatory"
|
||||
},
|
||||
{
|
||||
"stylesheetUrl": "css/theme-espresso.css",
|
||||
"priority": 1000
|
||||
},
|
||||
{
|
||||
"stylesheetUrl": "css/items.css",
|
||||
"priority": 901
|
||||
},
|
||||
{
|
||||
"stylesheetUrl": "css/tree.css",
|
||||
"priority": 900
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
"key": "bottombar",
|
||||
|
31
platform/commonUI/general/src/StyleSheetLoader.js
Normal file
31
platform/commonUI/general/src/StyleSheetLoader.js
Normal file
@ -0,0 +1,31 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
["angular"],
|
||||
function (angular) {
|
||||
"use strict";
|
||||
|
||||
function StyleSheetLoader(stylesheets, $document) {
|
||||
var head = $document.find('head');
|
||||
|
||||
function addStyleSheet(stylesheet) {
|
||||
var link = angular.element('<link>'),
|
||||
path = [
|
||||
stylesheet.bundle.path,
|
||||
stylesheet.bundle.resources,
|
||||
stylesheet.stylesheetUrl
|
||||
].join("/");
|
||||
|
||||
link.attr("rel", "stylesheet");
|
||||
link.attr("type", "text/css");
|
||||
link.attr("href", path);
|
||||
|
||||
head.append(link);
|
||||
}
|
||||
|
||||
stylesheets.forEach(addStyleSheet);
|
||||
}
|
||||
|
||||
return StyleSheetLoader;
|
||||
}
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user