liferay中css的自定义导入
2016-07-21 16:17
381 查看
1) 对于特别通用的文件,比如是ext-js库要使用到的css文件,你可以有2个选择:
选择1:放在ROOT/html/common/themes/top_head.jsp中:
..
<%-- Portal CSS --%>
<!--added by charles to load the ext-js css library-->
<link href="<%= HtmlUtil.escape(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNHost() + themeDisplay.getPathContext() + "/html/css/extjs/resources/css/ext-all.css")) %>" rel="stylesheet" type="text/css" />
<link href="<%= HtmlUtil.escape(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNHost() + themeDisplay.getPathContext() + "/html/css/main.css")) %>" rel="stylesheet" type="text/css" />
..
这种情况下,它将是整个服务器中第一个被加载的css(因为top_head.jsp被portal_normal.vm中包含):
选择2:放在ROOT/html/css/main.css以@import形式给出:
@import url(portal/aui.css);
/*
* add by charles here to load the global css
*/
@import url(extjs/resources/css/ext-all.css);
@import url(portal_1.css);
@import url(portal_2.css);
@import url(taglib_1.css);
@import url(taglib_2.css);
@import url(portal/openid.css);
@import url(portal/accessibility.css);
这种情况下, 这个css文件在所有的webapps下面的包含ROOT应用在内的所有应用的main.css加载之后,但是深入main.css中被包含的外部css文件之前被加载。
(2) 对于某个theme用到的css文件,你可以在这个theme的main.css中以@import形式给出
(3)对于某个portlet所特有的css文件,你可以在这个portlet的main.css中以@import形式给出
选择1:放在ROOT/html/common/themes/top_head.jsp中:
..
<%-- Portal CSS --%>
<!--added by charles to load the ext-js css library-->
<link href="<%= HtmlUtil.escape(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNHost() + themeDisplay.getPathContext() + "/html/css/extjs/resources/css/ext-all.css")) %>" rel="stylesheet" type="text/css" />
<link href="<%= HtmlUtil.escape(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNHost() + themeDisplay.getPathContext() + "/html/css/main.css")) %>" rel="stylesheet" type="text/css" />
..
这种情况下,它将是整个服务器中第一个被加载的css(因为top_head.jsp被portal_normal.vm中包含):
选择2:放在ROOT/html/css/main.css以@import形式给出:
@import url(portal/aui.css);
/*
* add by charles here to load the global css
*/
@import url(extjs/resources/css/ext-all.css);
@import url(portal_1.css);
@import url(portal_2.css);
@import url(taglib_1.css);
@import url(taglib_2.css);
@import url(portal/openid.css);
@import url(portal/accessibility.css);
这种情况下, 这个css文件在所有的webapps下面的包含ROOT应用在内的所有应用的main.css加载之后,但是深入main.css中被包含的外部css文件之前被加载。
(2) 对于某个theme用到的css文件,你可以在这个theme的main.css中以@import形式给出
(3)对于某个portlet所特有的css文件,你可以在这个portlet的main.css中以@import形式给出