-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: Allow localDev for direct CSS, JS assets mapping #33
base: main
Are you sure you want to change the base?
Conversation
Thanks for this @theodorosploumis! Could you explain the benefits of this PR? I see you mention:
Can you elaborate a bit more on that? |
Well, in our case we need to allow CSS themers to work independendly from local Drupal installation. So we point Storybook server URL to a remote (online) domain but CSS Themers can still work locally and compile their local CSS/JS.
I know that we could use another theming system like wingsuit or gesso but then we should loose all the magic from the new |
I understand better now. Will this work if the server URL contains a subdirectory? I am thinking about something like: server: {
url: "https://online-drupal-example.com/subdir/foo"
}, In any case, I want to wait and see if others find this feature useful before committing to maintain it. I believe you can use it via the canary package. |
Right, in order to make this work I have to add the Drupal web root for the So paths like
|
@e0ipso A canary release would be great! Thanks. |
This KINDA looks like it would help me work around the CORS issue I have in pokemon_card for the pokemon.js it has I'm eager to try this |
I like the idea of this, but I think the implementation complexity to account for all cases is too high. This assumes a particular setup, and feature set, that if you step away from things stop working. Things like where the Storybook instance is installed, weather the Drupal site is installed in a subdir, like I am inclined to leave this open, so other people can benefit from this work if they fit this use case. However, I am hesitant to merge it since it will likely end up being a source of feature requests, and support request. My preferred course of action is that this is moved to a separate addon, so it can be independent of this. I would be open to emitting events so other addons can react to the HTML Drupal returns. |
Allows a CSS developer to use the local CSS/JS assets (filesystem) inside Storybook instead of the Drupal remote url paths. This allows local development for CSS/JS somehow. Notice that twig files still come from the (remote) Drupal url.
For example:
<link rel="stylesheet" media="all" href="https://my-ocal.ddev.site/themes/custom/my_theme/css/components/messages.css?rvtpha">
will become
<link rel="stylesheet" media="all" href="/themes/custom/my_theme/css/components/messages.css?rvtpha">
and will point to the local CSS assets from Drupal root.