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

Incorrect output and duplication when defining a variable relative to another #105

Open
ecc521 opened this issue Sep 2, 2019 · 3 comments
Labels

Comments

@ecc521
Copy link

ecc521 commented Sep 2, 2019

Inputting the code

@media screen and (min-width: 500px) {
    :root {
        --defaultFontSize: 2.8vw;
        --specialFontSize: var(--defaultFontSize);
    }
}

@media screen and (min-width: 600px) {
    :root {
        --defaultFontSize: 3.8vw;
    }
}

body {
	font-size: var(--specialFontSize)
}

outputs

body {
	font-size: undefined
}

@media screen and (min-width: 600px) {

	body {
	font-size: undefined
	}
}

@media screen and (min-width: 500px) {

	body {
	font-size: 2.8vw
	}
}

@media screen and (min-width: 500px) {

	body {
	font-size: 2.8vw
	}
}

Note the font-size:undefined in the second declaration. That should be a 3.8vw.

@ecc521 ecc521 changed the title Invalid Declaration when defining a variable relative to another Incorrect output when defining a variable relative to another Sep 2, 2019
@ui-coder
Copy link

ui-coder commented Sep 5, 2019 via email

@ecc521
Copy link
Author

ecc521 commented Sep 5, 2019

That is actually what my site happened to do - the code in the bug report was just a short example.
Anyways, putting the following code into the playground results in incorrect values, as well as duplication:

:root {
	--defaultFontSize: 4vw;
	--specialFontSize: 3vw;
}

@media screen and (min-width: 500px) {
    :root {
        --defaultFontSize: 2.8vw;
        --specialFontSize: var(--defaultFontSize);
    }
}

@media screen and (min-width: 600px) {
    :root {
        --defaultFontSize: 3.8vw;
    }
}

body {
	font-size: var(--specialFontSize)
}

Yields

body {
	font-size: 3vw
}

@media screen and (min-width: 600px) {

	body {
	font-size: 3vw
	}
}

@media screen and (min-width: 500px) {

	body {
	font-size: 2.8vw
	}
}

@media screen and (min-width: 500px) {

	body {
	font-size: 2.8vw
	}
}

Notice how the output has a body {font-size: 3vw} inside the @media screen and (min-width:600px). This is incorrect, and should state body{font-size: 3.8vw}.

Additionally, there are two identical @media min-width 500px statements.

@ecc521 ecc521 changed the title Incorrect output when defining a variable relative to another Incorrect output and duplication when defining a variable relative to another Sep 5, 2019
@MadLittleMods
Copy link
Owner

The duplicated block is tracked by #67 and the wrong value is probably the same problem as #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants