์๋ฑํ ๋ณ์๋ก ๋ฐ์ดํฐ๋ฅผ ์ ์ฅ ํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ฌ์ฉ์ ์์ด์ ํธ : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
.
<style>
$text-color: red;
.header{
text-align: center;
}
.blog-post h2 {
color: $text-color;
}
</style>
<h1 class="header">Learn Sass</h1>
<div class="blog-post">
<h2>Some random title</h2>
<p>This is a paragraph with some random text in it</p>
</div>
<div class="blog-post">
<h2>Header #2</h2>
<p>Here is some more random text.</p>
</div>
<div class="blog-post">
<h2>Here is another header</h2>
<p>Even more random text within a paragraph</p>
</div>
์๋
ํ์ธ์ ์ฌ๋ฌ๋ถ, ์ ๋ Sass ๋ณ์๋ก ๋ฐ์ดํฐ ์ ์ฅ์ด๋ผ๋ ๋์ ์์ ๋ฒ๊ทธ๋ฅผ ๋ฐ๊ฒฌํ๋ค๊ณ ์๊ฐํฉ๋๋ค. ๋๋ ๋ชจ๋ ๊ฒ์ ์ฌ๋ฐ๋ฅด๊ฒํ๋ค๊ณ ์๊ฐํ์ง๋ง h2 ๋ฐ .blog-post ์์ ์์์ด ๋นจ๊ฐ์์ผ๋ก ๋ณ๊ฒฝ๋์ง ์์ต๋๋ค. ๋ ๊ฐ์ ์ฌ์ฉ์ ์คํ ๋ฆฌ๋ฅผ ์ ๋ฌํ์ง๋ง ๋ค์์ ์ ๋ฌํ์ง ์์ต๋๋ค.
.blog-post ์์๋ ๋นจ๊ฐ์์ด์ด์ผํฉ๋๋ค.
h2 ์์๋ ๋นจ๊ฐ์์ด์ด์ผํฉ๋๋ค.
๋ํ ๋นจ๊ฐ์์ผ๋ก ๋ณํ์ง ์์ต๋๋ค. ๊ทธ๋ฌ๋ ๊ทธ๊ฒ์ ์ฌ์ฉ์ ์คํ ๋ฆฌ๋ฅผ ์ ๋ฌํฉ๋๋ค.
์ฝ๋์๋ ๋นจ๊ฐ์ ๊ฐ์ผ๋ก $ text-color์ ๋ํด ์ ์ธ ๋ Sass ๋ณ์๊ฐ ์์ด์ผํฉ๋๋ค.
์ฝ๋๋ $ text-color ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ .blog-post ๋ฐ h2 ํญ๋ชฉ์ ์์์ ๋ณ๊ฒฝํด์ผํฉ๋๋ค.
๋ฏธ๋ฆฌ ๊ฐ์ฌ๋๋ฆฝ๋๋ค. ๋ฒ ํ์ ์๋ก์ด ๊ธฐ๋ฅ์ด ํ๋ฅญํด ๋ณด์ ๋๋ค. ๋ ๋ง์ ์์ ์ ๊ธฐ๋ค๋ฆด ์ ์์ต๋๋ค! ๐
@ Azbo400 ์ด ๋ฌธ์ ๋ฅผ๋ณด๊ณ ํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค. ์์ง Sass ์ปดํ์ผ์ ์ง์ํ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค ๐
@systimotic ์ค ํํ, ๋ง์ด ๋๋ค์! ๊ฐ์ฌํฉ๋๋ค ๐
์ ์ฃ์กํฉ๋๋ค! ์ด ์น์ ์ด ์ ๋๋ก ์๋ํ์ง ์์ ๊ฒ์ด๋ผ๋ ์ ์ ์ฌ๋๋ค์๊ฒ ์๋ ค์ผํ์ต๋๋ค. @ Azbo400 ๋ฌธ์ ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.
@HKuz ๊ด์ฐฎ์ต๋๋ค, ๋ฌธ์ ์์ต๋๋ค. ๐
๋ค. ์๋ํ์ง ์์ต๋๋ค. ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋๋ฉด ์๋ฆผ์ด ์์ต๋๊น?
์์ง "saas"๋ฅผ ์ง์ํ์ง ์์ต๋๋ค! ๋ผ๋ง ์ค !!!
2017 ๋ 1 ์ 22 ์ผ ์ค์ 12:19์ "Pramod Potdar" [email protected]์ด ์์ฑํ์ต๋๋ค.
๋ค. ์๋ํ์ง ์์ต๋๋ค. ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋๋ฉด ์๋ฆผ์ด ์์ต๋๊น?
โ
์ด ์ค๋ ๋๋ฅผ ๊ตฌ๋
ํ๊ธฐ ๋๋ฌธ์์ด ๋ฉ์์ง๊ฐ ์ ์ก๋์์ต๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ณ GitHub์์ ํ์ธํ์ธ์.
https://github.com/freeCodeCamp/freeCodeCamp/issues/12699#issuecomment-274311826 ,
๋๋ ์ค๋ ๋ ์์๊ฑฐ
https://github.com/notifications/unsubscribe-auth/AVHZeUIbLrZVFpBbIy0z9uTcDlOwHHoDks5rUvULgaJpZM4LqJWk
.
๊ทธ๋ค์ ๋น์ ์๊ฒ์ ์ด๋ค ๋ง๋ ์ํ์ง ์์ต๋๋ค. ๋๋ด
๋๋ ์ฌ๋๋ค์๊ฒ Sass๊ฐ ์์ง ์๋ํ์ง ์๋๋ค๊ณ ๊ฒฝ๊ณ ํ๋ ๊ฒ์ด ์ข์ ์๊ฐ์ด๋ผ๋ ๋ฐ ๋์ํฉ๋๋ค.
ํํธ, ๋๋ ์ฌ๋๋ค์ด Sass ์ปดํ์ผ๋ฌ๋ฅผ ์ค์นํ๊ณ ์์ ์ ์ปดํจํฐ์ ๊ทธ๋ค์ ๊ฐ์ด๋ (๋ฐ / ๋๋ FCC์ Sass ํํ ๋ฆฌ์ผ)๋ฅผ ๋ฐ๋ฅด๋ ๋ฐฉ๋ฒ์ ๋ํ Sass ๊ณต์ ํ์ด์ง์ ๊ฐ์ด๋๋ฅผ ๋ฐ๋ฅด๋ ๊ฒ์ด ์ข์ต๋๋ค. ๊ฐ์ด๋๋ ์ฌ๊ธฐ์์ ์์ํฉ๋๋ค. http://sass-lang.com/install
์ด๋ ค์ด ๋ณ์๋ก ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ๋ ๋ฌธ์ ๋ ํ ๋น ๋ ๋ณ์์ ์ฌ์ฉ์ ํ์ธํ ์ ์๋๋ก ๋ง์ง๋ง ๋ ํ ์คํธ๋ฅผ ๋ฆฌํฉํ ๋งํด์ผํฉ๋๋ค.
@ahmadabdolsaheb ๊ต์ฅ-์ข์ ์ ํ. ๋ฆฌํฉํ ๋งํ๋ ๋ฐฉ๋ฒ์ ์๊ณ ์์ต๋๊น?
@QuincyLarson ๋๋ ๊ทธ๊ฒ์์๋ค
๋๊ตฐ๊ฐ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ ๊ฒฝ์ฐ ๋ค์์ด ์ ์ฉ ํ ์ ์์ต๋๋ค.
๋ฆฌํฉํ ๋ง ํ ํ
์คํธ์ ์์น :
https://github.com/freeCodeCamp/freeCodeCamp/blob/6d7092928e852755fa0d4d9489b3c8748b466a94/seed/challenges/03-front-end-libraries/sass.json#L25
๋ค์ ๋ ๊ฐ์ง๋ก ๊ต์ฒดํด์ผํ๋ ๋ค ๊ฐ์ง ํ ์คํธ์ ๋๋ค.
"tests": [
{
"text": "Your code should have a Sass variable declared for <code>$text-color</code> with a value of red.",
"testString": "assert(code.match(/\\$text-color\\s*?:\\s*?red\\s*?;/g), 'Your code should have a Sass variable declared for <code>$text-color</code> with a value of red.');"
},
{
"text": "Your code should use the <code>$text-color</code> variable to change the <code>color</code> for the <code>.blog-post</code> and <code>h2</code> items.",
"testString": "assert(code.match(/\\.blog-post\\s*?\,\\s*?h2\\s*?{\\s*?color:\\s*?\\$text-color\\s*?;/g), 'Your code should use the <code>$text-color</code> variable to change the <code>color</code> for the <code>.blog-post</code> and <code>h2</code> items.');"
}
]
PR์ํ๊ธฐ ์ ์ ์๋ฃจ์ ์ ํ ์คํธํ์ญ์์ค
์๋ ํ์ธ์.
PR์ํ๊ธฐ ์ ์ ์๋ฃจ์ ์ ํ ์คํธํ์ญ์์ค
ํ
์คํธ๋ ์ด๋ป๊ฒํด์ผํฉ๋๊น? freecodecamp
๋ฆฌํฌ์งํ ๋ฆฌ์์๋ ์๋ ํ์ผ์ ๋ณ๊ฒฝํ๋ฉด @freecodecamp/curriculum
๋
ธ๋ ๋ชจ๋์ ์ฌ์ฉํ์ฌ ๋์ ์ ๋ฐ๊ธฐ ๋๋ฌธ์ learn
๋ฆฌํฌ์งํ ๋ฆฌ์ ๋ฐ์๋์ง ์์ต๋๋ค.
๋ด๊ฐ ๋ณํ ํ ๊ฒฝ์ฐ์๋ curriculum
๋ก์ปฌ REPO, ๊ทธ๊ฒ์์ ๋ฐ์๋์ง ์์ต๋๋ค learn
REPO.
์ง๊ธ Sass ์์
์ ์งํํ๊ณ ์์ต๋๋ค.
๊นจ์ง ๋ ์จ์ ์ถ๊ฐ๋ก ๊ฒ์ํ๊ฒ ์ต๋๋ค.
๊นจ์ง ํ
์คํธ๊ฐ ํฌํจ ๋ Sass ๊ฐ์ ์ ์ฒด ๋ชฉ๋ก :
https://learn.freecodecamp.org/front-end-libraries/sass/store-data-with-sass-variables
https://learn.freecodecamp.org/front-end-libraries/sass/use-for-to-create-a-sass-loop
https://learn.freecodecamp.org/front-end-libraries/sass/use-each-to-map-over-items-in-a-list
https://learn.freecodecamp.org/front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while
๋ค์์ ์๊ฐ ์๋ฃ์
๋๋ค.
๋ํ ๊ฐํ์ ์ธ ํ
์คํธ ํต๊ณผ ( "ํ
์คํธ ์คํ"์คํธ ๋ฐ์ก)๋ฅผ ํ์ธํ์ต๋๋ค.
https://learn.freecodecamp.org/front-end-libraries/sass/store-data-with-sass-variables
https://learn.freecodecamp.org/front-end-libraries/sass/use-each-to-map-over-items-in-a-list
๊ทธ๋ฌ๋ ๋ค๋ฅธ ๋ ๊ฐ์ ๊นจ์ง Sass ์์
์ ์๋๋๋ค (ํญ์ ํต๊ณผํ์ง ๋ชปํฉ๋๋ค).
https://learn.freecodecamp.org/front-end-libraries/sass/use-for-to-create-a-sass-loop
https://learn.freecodecamp.org/front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while
์ฒ์์๋ ๋์ผํ ๋ฌธ์ ๋ก ๊ณ ์ํ์ง๋ง ์ง๊ธ๊น์ง ๋ชจ๋ ํต๊ณผํด์ผํฉ๋๋ค ( @while ์์ ํฌํจ-๋ค๋ฅธ ์์ ๋ ์์ง ์๋ํ์ง ์์)-๋ฌธ์ ๋ ๊ณต๋ฐฑ ์ธ ๊ฒ ๊ฐ์ต๋๋ค.
์๋ฅผ ๋ค์ด @while ์์ ๋ SASS ๋นํธ์ ๋ค์ฌ ์ฐ๊ธฐ๋ฅผ ์ ๊ฑฐํด์ผํ์ต๋๋ค.
์ฝ๋ ์ฌ์ด์ ๋น ์ค์ ์ญ์ ํ๊ณ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์ผ๋ฉด SASS ์ฝ๋๋ฅผ ์ ํ ๋ค์ฌ ์ฐ์ง ๋ง์ญ์์ค.
[Safari 11.0.2์์ FCC ์ฌ์ฉ]
@MikeForde ์ด๊ฒ์์ด ๋ชจ๋์ ์ ๋ฌํ๊ธฐ ์ํด Safari๋ก ์ ํ ํ ๋ ์ ์๊ฒ
Safari ๋๋ Chrome 67์์ ์๋ํ์ง ๋ชปํ์ต๋๋ค.
๋ชจ๋ ๋ค์ฌ ์ฐ๊ธฐ ๋ฐ ๊ฐ๊ฒฉ ์ ๊ฑฐ
๋์ํ์ง ์์์ต๋๋ค. ๊ณต๋ฐฑ๋ณด๋ค ๋ ๋ง์ ๊ฒ์ด ์์ต๋๋ค. ๋ด๊ฐ ์์ ์ฐจ๋ฆฐ ๊ฒ์-
์๋ ํ์ธ์, ๋ฌธ์ ๊ฐ ๋ฌด์์ด๋ ์์ ๋ ๊ฒ ๊ฐ์ต๋๋ค. ์ฒ์์ผ๋ก ์ฑ๋ฆฐ์ง๋ฅผ ํต๊ณผํ์ผ๋ฉฐ Chrome ๋ฒ์ 67.0.3396.87 (๊ณต์ ๋น๋) (64 ๋นํธ)์ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
์๋์, ํ ์คํธ๋ฅผ ์๋ ํ ๋ ์ฌ์ ํ ๋ฐ์ํฉ๋๋ค. ์ผ๋ถ ์ฌ์ฉ์์๊ฒ๋ง ์ํฅ์ ๋ฏธ์น๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค-FireFox 56.0.2.
๋ชจ๋ ๊ณต๋ฐฑ์ ์ ๊ฑฐํ์ต๋๋ค. ๋ค์ฌ ์ฐ๊ธฐ ๋ฑ์ ํ์ธํ์ต๋๋ค.
๋ง์ง๋ง ๋ ํ
์คํธ๋ ์ฌ์ ํ ์คํจํ์ต๋๋ค. ํ
์คํธ ์คํ ๋ฒํผ์ "์คํธ"ํ๋ ค๊ณ ์๋ํฉ๋๋ค. ์ง๊ธ๊น์ง๋ ์ด์ด ์์ต๋๋ค.
=====
ํธ์ง : ๋๋์ด ์๋ํ๊ฒํ์ต๋๋ค. ๋ด ๋ถ๋ถ์ ์ฌ์ํ ์ค๋ฅ ๋๋ฌธ์ธ์ง ์๋๋ฉด ์ฐธ์์ฑ์๊ฒ "ํ
์คํธ ์คํ"๋ฒํผ์ ๋ฐ๋ณตํด์ ๋๋ ๋์ง ๊ธฐ์ตํ์ง ๋ง์ญ์์ค. ์ด ํ ์ฌ๋ฌ SASS ๊ฐ์์์ "ํ
์คํธ ์คํ ๋ฒํผ ๋งค์ฌ"๋ฐฉ๋ฒ์ ์ํํ์ต๋๋ค.
Sass์ ๋ํ ํธ๋ฆญ : @for ๋ฅผ ์ฌ์ฉํ์ฌ Sass ๋ฃจํ๋ฅผ ๋ง๋ญ๋๋ค.
์ด ๋์ ์๋ ํ์คํ ๋ฒ๊ทธ๊ฐ ์๊ธฐ ๋๋ฌธ์ ๋ ๋ฒ์งธ ๊ธฐํ๋ ์์ต๋๋ค ..
@for $j from 1 through 5 {
.text-#{$j} { font-size: 10px* $j; }
}
Hello
Hello
Hello
Hello
Hello
div ํ๊ทธ์ ์์ ์คํ์ผ์ ์ถ๊ฐ ํ ์ ์์ต๋๋ค. ์ด๊ฒ์ ๋๋ฅผ ์ํด ์๋ํฉ๋๋ค.
<div class="blog-post" style="color: red;">
@ mahmoud-coo6 ์กฐ๊ฑด์ด @while๋ก ์ถฉ์กฑ ๋ ๋๊น์ง ์คํ์ผ ์ ์ฉ์ ๋ํ ๋ฐฉ๋ฒ์ด ์๋ํฉ๋๊น?
์ฌ๊ธฐ์ ๊ฒฝ๊ณ ๊ฐ ์์ต๋๋ค : Your .text-1 class should have a font-size of 5px.
๊ธ๊ผด ํฌ๊ธฐ๊ฐ 5px๋ผ๊ณ ํ์ ํฉ๋๋ค.
@while๋ก ์กฐ๊ฑด์ด ์ถฉ์กฑ ๋ ๋๊น์ง ์คํ์ผ ์ ์ฉ์ ์์ ํฉ๋๊น? google-chrome ๋์ Firefox๋ฅผ ์ฌ์ฉํ์ฌ ๋์ ํ์ญ์์ค.
๋๋ div ํ๊ทธ์ ๋ฐฐ๊ฒฝ ์คํ์ผ์ ์ถ๊ฐํ๋ค.
<div class="blue-bg" style="background-color: blue"></div>
<div class="black-bg" style="background-color: black"></div>
<div class="red-bg" style="background-color: red"></div>
์ฌ๊ธฐ @flyfishingbarbara ์๋ฃจ์
: ์น ์ฌ์ดํธ์ ๋ฒ๊ทธ๊ฐ ์๊ธฐ ๋๋ฌธ์ ์๋ํ์ง ์๋ ์๊ฐ์ด ์์ต๋๋ค.
@each $color in blue,black, red {
.#{$color}-bg { background-color: $color;}
}
div {
height: 200px;
width: 200px;
}
@for
๋ฐ @each
๋ฌธ์ ๊ฐ ๋ค์ ๋ฐ์ํฉ๋๋ค.
Chrome 68.0.3440.106์์๋ ์๋ํ์ง ์๊ณ Opera 55.0์์๋ ์๋ํ์ง ์์ง๋ง Firefox 59.0.2 (๋ชจ๋ 64 ๋นํธ)์์๋ ์๋ฒฝํ๊ฒ ์๋ํ์ต๋๋ค. ๋ง์ง๋ง ์ธ ๊ฐ์ง ์ฐ์ต์๋ ์ฝ๊ฐ์ "ํ ์คํธ ์คํ"๋ฒํผ ์คํจ๋ฐ์ด ํ์ํ์ต๋๋ค.
ํธ์ ๋ด์ ๊ฐ๊ธฐ
์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ฉ๋๊น?
https://github.com/freeCodeCamp/freeCodeCamp/pull/27716
@paulywill ์ด๊ฒ์์ด ๋ฌธ์ ์ ๊ด๋ จ์ด ์์ผ๋ฉฐ ๋ฌธ์ ๋ ์ด๋ฏธ ๋ง์คํฐ ๋ธ๋์น์์ ํด๊ฒฐ๋์์ต๋๋ค.
์ ๋ ๊ฐ์ ๋ฌธ์ ๋ฅผ ๋ง๋ฌ์ต๋๋ค ...
@ZTYZZ ๋ฒ ํ ์ฌ์ดํธ ์์๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๊น?
Firefox Developer Edition (72.0b2 (64 ๋นํธ))์์๋ ์๋ํ์ง ์์ต๋๋ค.
@nmichalakis ๋ธ๋ผ์ฐ์ ์ฝ์์ ์ด๋ค ์ค๋ฅ๊ฐ ํ์๋ฉ๋๊น?
@RandellDawson ๋ณ์ ์ด๋ฆ๊ณผ ":"์ฌ์ด์ ๊ณต๋ฐฑ์ด ์์ผ๋ฉด "๋ฒ๊ทธ"๊ฐ ๋ฐ๊ฒฌ๋์ด ์ฌ๋ฐ๋ฅด๊ฒ ์ปดํ์ผ๋์ง ์์ต๋๋ค. ์ด๊ฒ์ ์ผ๋ฐ .scss ํ์ผ์์๋ ๋ฐ์ํฉ๋๊น?
์๋ฅผ ๋ค์ด ๋ด๊ฐ ๋ฌ๋ฆฌ๋ฉด
$ var-name : ์์; ( ":"์๋ค์ ๊ณต๋ฐฑ) ์ปดํ์ผ๋์ง ์์ง๋ง ๋์ผํ ์คํํ๋ฉด
$ var-name : color ($ var ์ ์ธ ๋ฐ๋ก ๋ค์ ๊ณต๋ฐฑ์ด ์์ผ๋ฉด ์๋ํฉ๋๋ค!)
์ด ์ธ๋ถ ์ฌํญ์ผ๋ก ์๋ก์ด ๋ฌธ์ ๋ฅผ์ฌ์ญ์์ค. ๊ฐ์ฌ.
@each $ color in blue, black, red {
. # {$ color} -bg {๋ฐฐ๊ฒฝ์ : $ color;}
}
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
div ํ๊ทธ์ ์์ ์คํ์ผ์ ์ถ๊ฐ ํ ์ ์์ต๋๋ค. ์ด๊ฒ์ ๋๋ฅผ ์ํด ์๋ํฉ๋๋ค.