Skip to content
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

Improvement in Create Reusable CSS with Mixins module #50155

Open
AnonSar opened this issue Apr 23, 2023 · 11 comments · May be fixed by #54657
Open

Improvement in Create Reusable CSS with Mixins module #50155

AnonSar opened this issue Apr 23, 2023 · 11 comments · May be fixed by #54657
Labels
first timers only Open for anyone doing contributions for first time. You do not need permission to work on these. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory.

Comments

@AnonSar
Copy link
Contributor

AnonSar commented Apr 23, 2023

Describe the Issue

Currently, the instructions within the Create Reusable CSS with Mixins module happen to be as follows:

Newer CSS features take time before they are fully adopted and ready to use in all browsers. As features are added to browsers, CSS rules using them may need vendor prefixes. Consider box-shadow:

div {
  -webkit-box-shadow: 0px 0px 4px #fff;
  -moz-box-shadow: 0px 0px 4px #fff;
  -ms-box-shadow: 0px 0px 4px #fff;
  box-shadow: 0px 0px 4px #fff;
}

For the sake of clarity, the above instructions should also explicitly point out which bits within the given code snippet are vendor prefixes, instead of just simply mentioning the word vendor prefixes within the instructions and expecting the users to figure out themselves as in which parts within the given code snippet are vendor prefixes.

Affected Page

https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/03-front-end-development-libraries/sass/create-reusable-css-with-mixins.md

Expected behavior

The instructions within the Create Reusable CSS with Mixins module should be as follows:

Newer CSS features take time before they are fully adopted and ready to use in all browsers. As features are added to browsers, CSS rules using them may need vendor prefixes ( -webkit, -moz, -ms etc ). Consider the box-shadow property below:

div {
  -webkit-box-shadow: 0px 0px 4px #fff;
  -moz-box-shadow: 0px 0px 4px #fff;
  -ms-box-shadow: 0px 0px 4px #fff;
  box-shadow: 0px 0px 4px #fff;
}

Screenshots

image

System

  • Device: Laptop
  • OS: macOS 13.0.1
  • Browser: Google Chrome
  • Version: 107.0.5304.110

Additional context

Would love to get some feedback from other members before I proceed ahead with making a PR for this issue. Thanks !

@AnonSar AnonSar added scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. labels Apr 23, 2023
@lasjorg
Copy link
Contributor

lasjorg commented Apr 24, 2023

I would be fine with it being more explicit. Not sure if it is really needed but it wouldn't hurt.


As an aside, using vendor prefixing to teach Mixins isn't a bad idea but the challenge just hasn't aged well. New features are now hidden behind feature flags and the standards have moved away from vendor prefixing. The box-shadow example seems very outdated.

https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix

@AnonSar
Copy link
Contributor Author

AnonSar commented Apr 25, 2023

Hey @lasjorg, thanks for sharing the article. After reading the article which you have shared, I can think of the following options:

  • Get rid of vendor prefixing from this challenge ( since the main focus of this challenge is to educate the users about Mixins ) and create a separate challenge to teach users about vendor prefixing.
  • Get rid of the box-shadow property in this challenge and instead, use such a CSS property in the example, which requires vendor prefixing ( came across an article that lists some CSS properties that require vendor prefixing as of 2021 )

Let me know what you think about it.

@lasjorg
Copy link
Contributor

lasjorg commented Apr 25, 2023

I wouldn't mind if this was rewritten but everything except parts of the challenge text would need to be changed (the challenge text, the example, the seed code, the requirements, the tests).


Motivation for rewriting the challenge:

  1. The challenge is introducing an unnecessary topic of vendor prefixing.

  2. The information about vendor prefixing is out of date.

Suggestion:

Give a simple example in the challenge text. The mixin will take a font size and a bottom margin, it will reset all other margins.

@mixin prose($font-size, $spacing) {
  font-size: $font-size;
  margin: 0;
  margin-block-end: $spacing;
}

p {
  @include prose(1.2rem, 1rem);
}

Seed code, in plain CSS to help make the challenge less copy-pasty.

<style type='text/scss'>
#square {
  width: 50px;
  height: 50px;
  background-color: red;
}
</style>

<div id="square"></div>

Solution/requirements

<style type='text/scss'>
@mixin shape($w, $h, $color) {
  width: $w;
  height: $h;
  background-color: $color;
}

#square {
  @include shape(50px, 50px, red);
}
</style>

<div id="square"></div>

@AnonSar
Copy link
Contributor Author

AnonSar commented Apr 27, 2023

Thanks for the suggestion @lasjorg, I'm happy to work on this issue. I will make a PR for this issue shortly, cheers 💫 !

@lasjorg
Copy link
Contributor

lasjorg commented Apr 27, 2023

You may want to wait with the PR until we get more consensus.

You can start working on it but I can't guarantee that it will be approved if others disagree with the change.

@lasjorg lasjorg added status: discussing Under discussion threads. Closed as stale after 60 days of inactivity. and removed type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. labels Apr 27, 2023
@AnonSar
Copy link
Contributor Author

AnonSar commented Apr 27, 2023

Thanks for letting me know @lasjorg, if that's the case, then I will wait and see what others think about the suggested change.

@raisedadead raisedadead removed the status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. label Aug 3, 2023
@naomi-lgbt
Copy link
Member

Let's go ahead and open this up, following lasjorg's suggestion above to rewrite the challenge.

The entire front-end libraries certification is pretty outdated, and next on our roadmap for a complete overhaul. But this is a pretty low-hanging fruit to hit now.

@naomi-lgbt naomi-lgbt added first timers only Open for anyone doing contributions for first time. You do not need permission to work on these. and removed status: discussing Under discussion threads. Closed as stale after 60 days of inactivity. labels Apr 26, 2024
irfanzainudin added a commit to irfanzainudin/freeCodeCamp that referenced this issue May 1, 2024
@irfanzainudin
Copy link

irfanzainudin commented May 1, 2024

Hi there, first of all I just want to thank you for the opportunity. This is my first time contributing and I decided to have a go at this issue and this is my attempt: Link to a branch of my forked repo

As per @lasjorg's suggestions, I removed any references to vendor prefixing as they are unnecessary and outdated.

In this rewrite, I kept the general structure of the challenge text but modified to suit the new example code. However, I didn't use the @mixin prose example given by @lasjorg as I think it'll be better to build on the previous challenges. So I did my own simple example about individual styles on headings, which is covered in previous challenges.

As for the task itself, I used @lasjorg's suggestion with some add-ons.

Tagging @naomi-lgbt for visibility.

Thank you! :)

@naomi-lgbt
Copy link
Member

Please open a pull request if you'd like your changes reviewed.

@irfanzainudin
Copy link

Oh right, I have opened a pull request however, I haven't tested the new code at all.

Could someone point me to a guide on how to do that?

irfanzainudin added a commit to irfanzainudin/freeCodeCamp that referenced this issue May 5, 2024
@irfanzainudin
Copy link

Hi, I've opened a new PR because I messed up my commit history and the previous PR got closed.

Very sorry for the inconveniences, please let me know if there's anything I need to fix.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first timers only Open for anyone doing contributions for first time. You do not need permission to work on these. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory.
Projects
None yet
5 participants