Customise CSS
Overview
This page explores the steps to publish CSS if there are any CSS customisations/changes. While customising, if any changes are made in the CSS folder, it has to be compiled and published to npm.
Steps
Currently, the CSS is published in npm as @egovernments/digit-ui-css
Refer to the NPM link here - digit-ui-css.
So any changes to the CSS folder locally must be published in different organisations and in the same or a different package name. For example, @xyz/digit-ui-css and version 1.0.0, then the following changes have to be made in the code to reflect in the digit-ui
index.html - file location
frontend/micro-ui/web/public/index.html
The style sheet link must be updated as follows,
<link rel="stylesheet" href="https://unpkg.com/@xyz/[email protected]/dist/index.css"/>
Use either of the following commands to publish the CSS
In the
frontend/micro-ui/web/micro-ui-internalsfolder runyarn run publish:cssorIn the
frontend/micro-ui/web/micro-ui-internals/packages/cssfolder runyarn run publish --access public
There are two ways to customise the CSS -
Override the required CSS only without changing it in the CSS folder and making changes only in the custom CSS folder. Both CSS files will be present in the index.html. The order of the package mentioned in the HTML determines which CSS needs to be taken, i.e., the box mentioned last will have more precedence. Example of overriding CSS as follows - index.html
Overwrite the complete existing CSS.
Reference doc for publishing any package to npm -
Creating and publishing scoped public packages | npm Docs
Note: The CSS has also been migrated from Node 14 to Node 20. The most significant change in this process was transitioning the build system from Gulp to Webpack. You can find the Webpack configuration file here:
NPM package link for the latest CSS version after upgrade.
Last updated
Was this helpful?