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.

[v1 branch] css tag template literal returns a single classname?

See original GitHub issue

I’m testing the v1 beta, and have noticed some styles failing to apply after switching from 0.x… the mapping of the computed module seems to be selecting an inner property…

const styles = _Icon_styles_module_css__WEBPACK_IMPORTED_MODULE_4___default.a.cls2;

this was computed from:

const styles = css`
	.input-icon {
		position: relative;
		display: inline-block;

		--icon-size: 34px;
	}

	.input-icon.placeholder-label {
		display: block;
	}
...

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
jquensecommented, Feb 17, 2021

yes in v1 css returns a single class, and you don’t include the class name in the declaration:

const popup = css`
    display: flex;
    flex-direction: column;
`

the stylesheet tag was added to take the place for what css used to do. The readme has not been updated yet, but there is an actual docs site https://astroturf.netlify.app/migration/ don’t be too worried, there are automated code-mods that should make the process of migrating completely automated

0reactions
fnpencommented, Feb 17, 2021

@jsg2021

We can use it:

import { stylesheet } from 'astroturf';
const styles = stylesheet`
  .popup {
    display: flex;

    flex-direction: column;
  }
`;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Stack your classes within template literals | by Chris Nager
Within my React components, I stack my CSS classes in a template literal. This gives me the added benefit of clearly defining my...
Read more >
Template Literals | CSS-Tricks
The Template Literal, introduced in ES6, is a new way to create a string. With it comes new features that allow us more...
Read more >
className error with tagged template literals #3259 - GitHub
Yes, I'm using NextJs. I should also mention this only happens if you are using a variable, it's working fine everywhere else.
Read more >
How to use template literals in tailwindcss to change classes ...
As long as a class name appears in your template in its entirety, Tailwind will not remove it from production build.
Read more >
Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded ...
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