question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax weirdness?

See original GitHub issue

This could be my fault, but if it’s not then it’s probably worth addressing.

/* variables.css */
@value borderRadius: 3px;
@value thing: pink;
/* styles.css */
@value vars: styles/variables.css;

@value borderRadius as br from vars;
@value thing from "styles/variables.css";
import styles from './styles.css'
console.log(styles);

Use case 1: If the first line of styles.css is written with quotes around the file name, like @value vars: "styles/variables.css;", then the value of styles.vars in JS is ""styles/variables.css""; a string that includes the quote marks. I’m not sure if the README just needs to be updated to remove the quotes or if this is a bug.

Use case 2: If quotes are omitted when getting a value directly (@value thing from "styles/variables.css";) the rest of the line is interpreted literally, resulting in the value of styles.thing being "from styles/variables.css". Maybe this is related to the colon being optional?

Basically, it seems odd to require the omission of quotes in Use Case 1 and require the inclusion of quotes in Use Case 2. They’re doing nearly the same thing, so I’d expect a consistent syntax.

Is this intended, a bug, or something I’m doing wrong?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
dspnormancommented, Feb 6, 2016

@bclinkinbeard I am also seeing the issue you describe with this syntax:

@value vars: styles/variables.css;

.myList {
  composes: abs-pos from vars;
}

This produces a build error of referenced class name "abs-pos" in composes not found.

It’s a shame, because this is the syntax presented as an example on the postcss-modules-values project README, and I imagine quite a few folks being mystified when it doesn’t work.

0reactions
OliverJAshcommented, May 16, 2017

I also ran into this. The README is misleading. My error:

Module build failed: referenced class name "from" in composes not found (6:3)

  4 | .notification {
  5 |   color: primary;
> 6 |   composes: notification from notificationListItem;
Read more comments on GitHub >

github_iconTop Results From Across the Web

`let` syntax weirdness - Internals & Design - Julia Discourse
This is intended and I believe is the normal behavior of let from lisp: the let block introduces a new scope, but only...
Read more >
Weird Syntax!: Parametric Symbolism - Medium
Weird Syntax !: Parametric Symbolism. Parametric Symbolism and using it as a programming technique. Photo by Dan ...
Read more >
Why is Tcl syntax so weird (2013) - Hacker News
What's weird about the Tcl syntax is that there is barely any. It's very dynamic so only the top-level of a file is...
Read more >
CFML Syntax Weirdness : CFML-22 - JetBrains YouTrack
CFML Syntax Weirdness. I think the keyword var is flipping out in expressions, just this the below statement causes a "binary operation expected"....
Read more >
Why do functional programming languages have such weird ...
The “weirdness” comes from two sources. Lisp DOES have a weird syntax. The really weird thing is the pre-fix notation for arithmetic which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found