-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Integrates custom scss & callouts #1013
Conversation
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.
@Ethan0429 thanks for this!
I'm not familiar with the details of SCSS, but I think it's unlikely that importing the same file twice (instead of once) will break any sites.
@mattxwang I've also checked that just-the-docs-tests builds and displays a pink callout when using: remote_theme: Ethan0429/just-the-docs@patch-1 |
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.
Going to override @pdmosses' review here; I don't think we can merge this.
I'm not familiar with the details of SCSS, but I think it's unlikely that importing the same file twice (instead of once) will break any sites.
So, this is not true: if you import any SASS file twice, you are:
- re-executing all the logic within the SASS file
- re-emitting all CSS rules
The former could cause breaking behaviour (ex adding to a map twice), and the latter bloats code.
(you can test this by adding any CSS rule to custom.scss
in the test branch)
I still agree that the issue is a problem, however I don't think that this current PR solves the problem. Bigger picture, my opinion is that this is a problem with the "overloading" of custom.scss
. There are two distinct types of use-cases:
- SASS variable declarations that we want to be accessible to our underlying generator code. This is a forward declaration; we want this to be added as soon as possible in the SASS cascade, but after our default variables.
- Custom CSS rules that override existing generated code. We want this to be the very last thing in the cascade.
Ideally, what we should do (instead of this PR) is add an import that occurs right after our last variable declaration, and before our first emitted CSS - custom callout variables should go in there, instead of in custom.scss
. This would also necessitate us updating our instructions for callouts.
Thoughts @pdmosses @Ethan0429 @deseo @clarisma (people involved in this PR and #1010)
In the discussion of #1011, I suggested putting custom colors for callouts in the various color schemes, which are also imported before the |
If a user copies the built-in color schemes Instead of copying files from the theme and editing them, users could define custom color schemes, say This would be complementary to adding/setting variables that apply to all color schemes. BTW, it seems a bit odd that custom color schemes are located in |
@mattxwang Would you like me to submit a PR for importing a new custom file
Right. If we're going to make this change, we'd better do it before the release of v0.4.0. The docs for configuring callouts will need to warn against defining custom callout colors in I think custom callout colors that depend on the color scheme should be defined in
{% if site.logo %}
$logo: "{{ site.logo | relative_url }}";
{% endif %}
@import "./support/support";
@import "./color_schemes/light";
@import "./color_schemes/{{ include.color_scheme }}";
@import "./modules";
{% include css/callouts.scss.liquid color_scheme = include.color_scheme %}
{% include css/custom.scss.liquid %}
When |
Thanks for your patience everyone, been a bit behind due to personal circumstances. Let me put the concise/actionable answers first.
Personally leaning towards this, as
My opinion is no, they should not; if they want to have this association, they could define it in a custom color scheme (like you've suggested in a later comment)
Agreed and agreed. The nice thing is, if we do this all properly, none of this is a breaking change from v0.3.3: we're simply adding a new custom import and adding callouts. This is only breaking for prior prerelease users. @Ethan0429, I know this has been a wall of text; does that make sense? Since you also did the initial investigation, I think it would be appropriate if you wanted to take on this PR and/or we made you a co-author of whatever we do end up merging. Other responses:
Hm, you may be right - I made that comment previously since I had helped debug a coworker with this exact problem (they loaded a SASS file twice, and added to a map twice). However, that was a couple of years ago - I wonder if since then, the SASS spec has changed? (can't remember the example now, but it may have been that the RHS of the set expression had some sort of mutable call) No worries if I can't recall, we can strike this from the record if necessary.
Certainly no expert, but in my work contributing to Stylelint I've noticed that all the
I have no strong opinion here! Happy to discuss (perhaps in an issue) |
@mattxwang wrote:
I've added a regression test for using custom colors in callout configurations. If this PR is changed to introduce a new custom file for variables, the test will also need updating. |
@mattxwang wrote:
@Ethan0429 Would you like to proceed with revising this PR, or submit a fresh one? |
@pdmosses Apologies for the late reply. I'll see to revising the PR ASAP. Thank you all for the support! |
Review retracted following subsequent discussion
(same comment made in issues) |
Hm, @simonebortolin so I'm not sure if this is what I'm suggesting / the core problem.
The proposed solution is just code motion + documentation, so I anticipate it shouldn't be too complicated. @Ethan0429 what are your thoughts? There's no obligation at all to do this if you're not available; I can add it to my backlog (or re-outline this in an issue and have someone else pick it up) if you'd like. Contributions are always welcome! |
Hi @Ethan0429, just wanted to check in on the state of this PR. Is there anything I can do to support you? Appreciate your initiative thus far! |
This is an alternative PR that resolves #1011. Unlike #1013, this PR defines a *new* SASS file, `_sass/custom/setup.scss`, specifically designed for new custom variables (and other SASS-only constructs). It's imported after our `support` SASS files are (functions, variables), but otherwise is imported before all other files (ex, when CSS is emitted). So, custom callout colors can now be defined in this file. I also move the custom callout colors present in `custom.scss` to the right location. I've added some docs that briefly explain how to use the feature. Feedback is welcome! --- As an aside, I chose not to add a `_includes/css` file that imports this, and then import that file. I think that's only necessary if we're trying to render liquid somehow in the SASS file; since we're not trying to do that for `setup.scss`, I've opted to not include it. If we think this is relevant, I can re-add it. Co-authored-by: Peter Mosses <18308236+pdmosses@users.noreply.github.com>
Closed by #1135. |
Tested locally with my own fork of just-the-docs, and it fixes the issue from #1011. As suggested by @pdmosses.