-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Source-loader: Handle template strings in CSF title #8995
Merged
shilman
merged 9 commits into
storybookjs:next
from
atanasster:csf-title-template-string
Dec 2, 2019
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
91b0d7a
handle template strings in csf title
atanasster 178cc31
Update inject-decorator.csf.test.js.snap
shilman 6e98d2c
make changecompatible backwards
atanasster 4140383
Merge branch 'csf-title-template-string' of https://github.com/atanas…
atanasster 9401302
made template title example more real-life
atanasster 4299c34
simplify conditional
atanasster bcf66e3
restore snapshot file
atanasster d92b315
Update addon-docs.stories.js
shilman be3baa1
Merge branch 'next' into pr/8995
shilman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 suppose the support is actually quite limited?
wouldn't actually work?
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.
works, I tried the following more real-life examples:
or
and similar.
For other cases like expressions, dynamic functions etc - I assume there is some library that does ast node value evaluation, but I couldn't find one.
I checked in a better example and made the behavior backwards compatible for non-strings
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.
What about
paths.macro
? Can it evaluate that correctly?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.
The evaluation itself works fine. However there are some rules for titles - it can not finish in
/
.for example we have:
import base from 'paths.macro'
that evaluates to
/stories/addon-docs/
In the case those will work:
However currently this will not work directly (ends in
/
):title: `Docs${base}`