-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Adds SCSS support for plugins #19643
Conversation
@@ -48,6 +48,12 @@ export class PluginSpec { | |||
* directory for this plugin. The final directory must have the name "public", | |||
* though it can be located somewhere besides the root of the plugin. Set | |||
* this to false to disable exposure of a public directory | |||
* @param {String|False} [opts.styleSheet] path to the stylesheet within |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on the naming of these two options? Would styleSheetPath
and scssPath
be better?
Still working on figuring out how we should trigger transpiring the SCSS when running a build for both Kibana and individual plugins. During the plugin build process, we currently don't have a way of accessing the Kibana Plugin options. We might need to resort to calling the index file with babel register. |
|
Actually, we shouldn't need to transpile SCSS during the build if we required that the CSS be committed. Thoughts? |
0097594
to
44e815b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌟 I tested this locally and it works as described. I also read through the code and it seems clear enough. Great job @tylersmalley!
💚 Build Succeeded |
Spencer notes:
|
This comment has been minimized.
This comment has been minimized.
retest
|
This comment has been minimized.
This comment has been minimized.
retest
|
💔 Build Failed |
retest this is absurd ... |
💔 Build Failed |
retest
|
^ looks like this is also happening on master. Pinged the viz team. |
💚 Build Succeeded |
main: 'plugins/<%= kebabCase(name) %>/app' | ||
main: 'plugins/<%= kebabCase(name) %>/app', | ||
<% if (generateScss) { %> | ||
styleSheetPath: `${require('path').resolve(__dirname, 'public/app.scss')}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: unnecessary template literal
@@ -168,6 +168,36 @@ export class PluginSpec { | |||
return this._uiExports; | |||
} | |||
|
|||
getExportAppSpecs() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods and their tests should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit and some simple removal, but once those are taken care of LGTM!
Signed-off-by: Tyler Smalley <[email protected]>
💚 Build Succeeded |
Signed-off-by: Tyler Smalley <[email protected]>
Hooray! Thanks all. |
❤️!!! |
Signed-off-by: Tyler Smalley <[email protected]>
6.4/6.x: a1b5a56 |
Closes: #15274
This adds
styleSheetPath
as an option for UIExport appstyleSheetPath
: Absolute path to the stylesheet within the plugins public directory. When provided, this will be used to when the plugin is active. When an SCSS file is provide, it will be transpiled into CSS. If a CSS file is provide, it will be loaded when the plugin is active.Example:
index.js:
The same is for external plugins, However
styleSheetToCompile
needs to be specified in.kibana-plugin-helpers.json
and is relative to the root of the plugin.Example:
index.js:
.kibana-plugin-helpers.json:
Testing
For core plugins, I would suggest modifying one to use SCSS.
Adding
styleSheetPath
to the Timelion UiExports app configuration. Kibana will need to correctly pick these settings up.Next, create
src/core_plugins/timelion/public/timelion.scss
and add a style. For demonstration, I am using the following:When in development mode, a message will be logged when we transpile the SCSS into CSS.
Errors are expected to be logged. Removing one of the brackets in the example will cause this.
During development, the CSS file will be generated with source-maps when an SCSS file is modified and served when the plugin is active. This CSS file is in addition to the plugins CSS file created by the optimizer, however, that will be phased out as we migrate to SCSS.
When building a plugin outside of Kibana, you need to also set
styleSheetToCompile
in the.kibana-plugin-helpers.json
.For testing of external plugins,
node scripts/generate_plugin.js
will setup SCSS support based on your response to the questionShould SCSS be used?
.