This will be a meta issue for tracking conversion of Kibana's 307 Less files to Sass.
Because of the size of the changes we should consider staging this out. I could see us doing the following...
After the above is done
These are simple examples, not meant to be full code methodologies and pathing scenarios.
Kibana is made up of three major parts: The inherited EUI components, the global Kibana global blob, and individual Kibana plugins.
// kibana_global.scss
// EUI global scope
@import 'node_modules/@elastic/eui/src/themes/k6/k6_globals';
@import 'node_modules/@elastic/eui/src/themes/k6/k6_colors_light';
@import 'node_modules/@elastic/eui/src/global_styling/functions/index';
@import 'node_modules/@elastic/eui/src/global_styling/variables/index';
@import 'node_modules/@elastic/eui/src/global_styling/mixins/index';
// This should be a one liner to import all of EUI's actual component css
@import eui/components
// This would be all kibana components that are considered core to Kibana, hopefully living in the same directory structure somewhere in Kibana.
@import 'kibana_global/variables'
@import 'kibana_global/mixins'
@import 'kibana_global/components'
// For all the stuff we can't get rid of yet
@import 'kibana_global/hack'
Then Kibana's core global scope includes/inherits EUI and builds beyond it with it's own global mixins and components in a single css blob. Anything in this file would be considered usable UI for all of Kibana. We'll have better control over the load order and be able to run proper trash tests as we remove code over time.
Plugins would be separated into their own css files (as shown earlier) and loaded only within their plugin scope.
Kibana is mostly made up of plugins. We should aim to move all styling to match the below structure.
src/some_plugin/
+-- public
| +-- components
| | +-- componentName
| | | +-- _index.scss
| | | +-- _component.scss
+-- index.scss
// Should import both the EUI constants and any Kibana ones that are considered global
@import '_kibana_styling_constants';
// Temporary hacks
@import 'hacks';
// Monitoring plugin styles
// Prefix all styles with "mon" to avoid conflicts.
// Examples
// monChart
// monChart__legend
// monChart__legend--small
// monChart__legend-isLoading
@import 'components/chart/index';
@import 'components/no_data/index';
@import 'components/sparkline/index';
@import 'components/summary_status/index';
@import 'components/table/index';
@import 'components/logstash/pipeline_viewer/views/index';
@import 'directives/chart/index';
@import 'directives/elasticsearch/shard_allocation/index';
Then in the files themseslves
// ./plugin_component_one.scss
// Use a prefix for the file being built, let's use "mon" for "monitoring"
.monChart__legend--small {
color: $euiColor;
width: $euiSize;
}
@euiBreakpoint("xs", "s") {
...
}
Kibana core is essentially everything in src/ui/ (which is a lot of files)
KUI (aka ui_framework) should be audited for unused components. Existing, in use ones should import the EUI global scope so that it matches EUI theming as much as possible.
.kuiTestbed selector with some comments)@cchaos :
We also need to remove any .LESS file references to removed files in here: https://github.com/elastic/kibana/blob/95edbcdfbf6d3358bd50d6802859966639c29c46/src/dev/precommit_hook/casing_check_config.js#L106
Closing this issue. Outside of some hanger on issues, it's complete and would be better served by smaller, clean up issues.
Most helpful comment
Closing this issue. Outside of some hanger on issues, it's complete and would be better served by smaller, clean up issues.