Skip to content

Documentation Site - #208

Merged
davidcheung merged 10 commits into
mainfrom
doc-site
Jul 13, 2021
Merged

Documentation Site#208
davidcheung merged 10 commits into
mainfrom
doc-site

Conversation

@davidcheung

Copy link
Copy Markdown
Contributor

No description provided.

@davidcheung
davidcheung requested a review from a team as a code owner July 6, 2021 16:25
Comment on lines +1 to +20
/** @type {import('@docusaurus/types').DocusaurusConfig} */
const child_process = require('child_process');

const remoteCommonCssFile = 'https://raw.githubusercontent.com/commitdev/zero/doc-site/doc-site/src/css/custom.css';
const cssDownloadPath = './src/css/zero-downloaded-global-custom.css';

function downloadCss(url, saveTo) {
child_process.execFileSync('curl', ['--silent', '-f', '-L', url, '-o', saveTo], {encoding: 'utf8'});
return require.resolve(saveTo);
}

// This is to download the CSS from commitdev/zero instead of using the local copy, this
// allows us to maintain only one set of global css throughout the modules and have
// consistent look and feel throughout the modules, this is synchronous but only runs during build time
let customCss;
try {
customCss = downloadCss(remoteCommonCssFile, cssDownloadPath)
} catch (e) {
customCss = require.resolve('./src/css/fallback.css');
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The weird thing to note here is I'm downloading the global css file from zero repo then if it fails, it uses its original copy instead. Its a synchronous action but it only happens during build time in CI.

Comment thread doc-site/sidebars.js Outdated
type: 'link',
label: 'Backend - Node.js',
href: `${config.url}/docs/modules/backend-nodejs`,
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking of a way to consolidate all these repeated and should stay the same UI components, perhaps make a common npm package and use that.

@davidcheung
davidcheung merged commit 04e2d42 into main Jul 13, 2021
@davidcheung
davidcheung deleted the doc-site branch July 13, 2021 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants