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.

Will this support dynamic whole CSS property entries?

See original GitHub issue

Ex.


import { styled } from '@compiled/css-in-js';

const Foo = styled.div`
  ${(props) => (props.on ? 'color: red;' : 'color: black;')}
`

Today, this throws a

@parcel/transformer-babel: <css input>:3:3: Unknown word
          CssSyntaxError: <css input>:3:3: Unknown word

I would provide a codesandbox but I’ve had a hard time getting @compiled running in any, is there a starter template in codesandbox? .

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
pgmanutdcommented, Oct 3, 2020
1reaction
itsdougescommented, Oct 3, 2020

Hi,

At the moment that CSS won’t be able to defined like that (so alternatively define it as just the value and it will work).

I have some ideas how we can enable this though (because it’s still static) but we have other priorities at the moment.

We should add a better error message for this case!

On Sun, 4 Oct 2020, 4:13 am butlersrepos, notifications@github.com wrote:

Ex.

import { styled } from ‘@compiled/css-in-js’;

const Foo = styled.div ${(props) => (props.on ? 'color: red;' : 'color: black;')}

Today, this throws a

@parcel/transformer-babel: <css input>:3:3: Unknown word CssSyntaxError: <css input>:3:3: Unknown word

I would provide a codesandbox but I’ve had a hard time getting @compiled https://github.com/compiled running in any 😦 .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/atlassian-labs/compiled/issues/307, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT4PHOTQEHO7XLBLRUZ2NTSI5LTFANCNFSM4SDEI4EA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make Your CSS Dynamic with CSS Custom Properties - Toptal
Explore CSS custom properties and find out how they can be used to make better, more dynamic stylesheets.
Read more >
CSS Custom Properties—Dynamic Changes With Javascript
One of the main advantages of CSS custom properties is the ability to change them in response to Javascript or user interaction.
Read more >
Using CSS custom properties (variables) - MDN Web Docs
Each CSS property can be assigned a defined set of values. If you try to assign a value to a property that is...
Read more >
Angular 2 - How to dynamically change an entire CSS ...
In short, we want 1 app that can be styled by a CSS file, based off a queryparam. All thoughts and comments will...
Read more >
A Complete Guide to CSS Functions
There is only one function specific to CSS custom properties, but it makes the whole thing tick! The var() function is used to...
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