Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting CP Documentation asset paths by environment #470

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
!!! 5
-# Set path to CSS
- rhDocsCssPath = '/static/rhdocs.css'
- pantheonCssPath = '//access.redhat.com/webassets/avalon/j/public_modules/node_modules/@cpelements/cp-documentation/dist/rhdocs.min.css'
- portalUrl = 'access.redhat.com'

- if (@document.attr :pantheonenv) == 'dev'
- portalUrl = 'access.dev.redhat.com'
- if (@document.attr :pantheonenv) == 'dev2'
- portalUrl = 'access.dev.redhat.com'
- if (@document.attr :pantheonenv) == 'qa'
- portalUrl = 'access.dev.redhat.com'
- if (@document.attr :pantheonenv) == 'stage'
- portalUrl = 'access.dev.redhat.com'

- pantheonCssPath = "//#{portalUrl}/webassets/avalon/j/public_modules/node_modules/@cpelements/cp-documentation/dist/rhdocs.min.css"
- cpDocsJsPath = "//#{portalUrl}/webassets/avalon/j/public_modules/node_modules/@cpelements/cp-documentation/dist/cp-documentation.umd.js"

- if (@document.attr :pantheonenv) == 'localwebassets'
- rhDocsCssPath = '/dev-preview/rhdocs.css'
- pantheonCssPath = '/dev-preview/pantheon.css'

- wrappingTag = 'cp-documentation'
-# - if (@document.attr :pantheondoctype) == 'assembly'
-# - wrappingTag = 'div'

%html{:lang=>(attr :lang, 'en')}
%head
Expand All @@ -25,35 +30,26 @@
%title=((doctitle :sanitize => true) || (attr 'untitled-label'))
%link(rel="stylesheet" href="https://static.redhat.com/libs/redhat/redhat-font/2/webfonts/red-hat-font.css")

%link(rel="stylesheet" href=pantheonCssPath )
%link(rel="stylesheet" href=rhDocsCssPath )


- if (@document.attr :pantheonenv) == 'localwebassets'
%script(src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.3.0/custom-elements-es5-adapter.js")
%script(src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.3.0/webcomponents-bundle.js")
%script(src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js")
%script(type="module" src="/node_modules/@cpelements/cp-documentation/dist/cp-documentation.js")

- else
- # Dummy cp chrome code
:javascript
window.portal = {
analytics : {},
host : "https://access.redhat.com",
idp_url : "https://sso.redhat.com",
lang : "en",
version : "7b09880",
builddate : "2020-06-10T14:50:01.831Z",
fetchdate : "2020-06-10T14:50:04-0400",
nrid : "14615289",
nrlk : "2a497fa56f"
};
%script(src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.3.0/custom-elements-es5-adapter.js")
%script(src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.3.0/webcomponents-bundle.js")
%script(src="https://access.redhat.com/webassets/avalon/j/lib/require.js")
:javascript
chrometwo_require(["//access.redhat.com/webassets/avalon/j/public_modules/node_modules/@cpelements/cp-documentation/dist/cp-documentation.umd.js"]);
%link(rel="stylesheet" href=pantheonCssPath)

- # Dummy cp chrome code
:javascript
window.portal = {
analytics : {},
host : "https://#{portalUrl}",
idp_url : "https://sso.redhat.com",
lang : "en",
version : "7b09880",
builddate : "2020-06-10T14:50:01.831Z",
fetchdate : "2020-06-10T14:50:04-0400",
nrid : "14615289",
nrlk : "2a497fa56f"
};
%script(src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.3.0/custom-elements-es5-adapter.js")
%script(src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.3.0/webcomponents-bundle.js")
%script(src="https://#{portalUrl}/webassets/avalon/j/lib/require.js")
:javascript
chrometwo_require(["#{cpDocsJsPath}"]);

:javascript
window.addEventListener('load', function() {
Expand Down