CSS LIBRARY ISOLATION
Cascading style sheets (CSS) library isolation can include replacing instances of a definition of a base root element font size from CSS code of a user interface (UI) plugin to a hosting application with a CSS variable as the CSS code is compiled to a CSS file, reading a definition of a quantity of pixels per one root element font size from the UI plugin, calculating a ratio between the base root element font size of the UI plugin and a base root element font size of the hosting application in pixels, and defining the CSS variable as the ratio at runtime.
1 . A method, comprising:
replacing instances of a definition of a base root element font size from cascading style sheets (CSS) code of a user interface (UI) plugin to a hosting application with a CSS variable as the CSS code is compiled to a CSS file;
reading a definition of a quantity of pixels per one root element font size from the UI plugin;
calculating a ratio between the base root element font size of the UI plugin and a base root element font size of the hosting application in pixels; and
defining the CSS variable as the ratio at runtime.
2 . The method of claim 1 , wherein the hosting application comprises a cloud services platform UI.
3 . The method of claim 2 , further comprising borrowing, by the UI plugin, a CSS library from the cloud services platform UI.
4 . The method of claim 2 , further comprising supporting multiple versions of a CSS framework simultaneously in a browser without spacing side effects from the multiple versions of the CSS framework.
5 . The method of claim 4 , wherein the runtime comprises runtime of the cloud services platform UI.
6 . The method of claim 1 , comprising calculating the ratio at runtime.
7 . The method of claim 6 , wherein the hosting application includes a definition a quantity of pixels per base root element font size that is different than the definition of the quantity of pixels per base element font size of the UI plugin.
8 . The method of claim 1 , further comprising replacing respective instances of the definition of the base root element font size from respective CSS code of each of a plurality of versions of the UI plugin with a respective CSS variable as the respective CSS code is compiled to respective CSS files;
reading a respective definition of a quantity of pixels per one root element font size from each of the plurality of UI plugins;
calculating a respective ratio between the base root element font size of each of the plurality of UI plugins and the base root element font size of the hosting application in pixels; and
defining the respective CSS variable as the respective ratio at runtime.
9 . A non-transitory machine-readable medium having instructions stored thereon which, when executed by a processor, cause the processor to:
replace instances of a first definition of a base root element font size from code of a first version of a user interface (UI) plugin to a hosting application with a first cascading style sheets (CSS) variable as the code of the first version of the UI plugin is compiled;
replace instances of a second definition of a base root element font size from code of a second version of a UI plugin to the hosting application with a second CSS variable as the code of the second version of the UI plugin is compiled;
read a first definition of a first quantity of pixels per one root element font size from the first version of the UI plugin;
read a second definition of a second quantity of pixels per one root element font size from the second version of the UI plugin;
calculate a first ratio between the base root element font size of the first version of the UI plugin and a base root element font size of the hosting application in pixels;
calculate a second ratio between the base root element font size of the second version of the UI plugin and a base root element font size of the hosting application in pixels;
define the first CSS variable as the first ratio at runtime of the hosting application; and
define the second CSS variable as the second ratio at runtime of the hosting application.
10 . The medium of claim 9 , further comprising instructions to:
replace instances of a third definition of a base root element font size from code of a third version of a UI plugin to the hosting application with a third CSS variable as the code of the third version of the UI plugin is compiled;
read a third definition of a second quantity of pixels per one root element font size from the third version of the UI plugin;
calculate a third ratio between the base root element font size of the third version of the UI plugin and a base root element font size of the hosting application in pixels; and
define the third CSS variable as the second ratio at runtime of the hosting application.
11 . The medium of claim 9 , wherein the first quantity of pixels per one root element font size is different than the second quantity of pixels per one root element font size.
12 . The medium of claim 9 , wherein the hosting application comprises a cloud services platform UI.
13 . The medium of claim 12 , further comprising instructions to present a webpage to a first user of the first version of the UI plugin without spacing side effects; and
present the webpage to a second user of the second version of the UI plugin without spacing side effects.
14 . The medium of claim 9 , wherein the first version of the UI plugin was developed for a previous version of the hosting application that included a different CSS library than a current version of the hosting application.
15 . A system, comprising:
processing and memory resources configured to:
provide a cloud services platform user interface (UI);
support a plurality of versions of a UI plugin hosted by the cloud services platform UI with a current version of a cascading style sheets (CSS) library of the cloud services platform UI;
replace instances of a respective definition of a base root element font size from CSS files of each UI plugin with a respective CSS variable at compile time;
read a respective definition of a respective quantity of pixels per one root element font size from each UI plugin;
calculate a respective ratio between the respective base root element font size of each UI plugin and a base root element font size of the cloud services platform UI in pixels; and
define the respective CSS variable as the respective ratio at runtime.
16 . The system of claim 15 , wherein the processing and memory resources are further configured to provide the current version of the CSS library from the cloud services platform UI to each UI plugin.
17 . The system of claim 15 , wherein the processing and memory resources are further configured to support multiple versions of a CSS framework simultaneously in a browser without spacing side effects from the multiple versions of the CSS framework.
18 . The system of claim 17 , wherein spacing side effects comprise root element font sizes different than the current version of the CSS library.
19 . The system of claim 17 , wherein the processing and memory resources are further configured to:
allow a user to select a desired browser font size; and
allow the user-selected font size to affect a font size presented in an application hosted by the cloud services platform UI.
20 . The system of claim 15 , wherein the processing and memory resources are further configured to present a common visualization via each UI plugin regardless of the respective definition of the base root element font size from CSS files of each UI plugin.