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.

use of css attributes results in css="[object Object]"

See original GitHub issue

import "twin.macro";

tw="border-2 border-red-400"

Results in:

image

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
xairoocommented, Feb 14, 2021

A bit more detailed… how to enable css prop in react (https://emotion.sh/docs/css-prop)!

I use craco with create-react-app to modify webpack, babel, …

Just install @emotion/babel-preset-css-prop and add it to your craco.config.js:

module.exports = {
	babel: {
		presets: ['@emotion/babel-preset-css-prop'],
		plugins: [],
		loaderOptions: {
			/* Any babel-loader configuration options: https://github.com/babel/babel-loader. */
		},
		loaderOptions: (babelLoaderOptions, { env, paths }) => {
			return babelLoaderOptions;
		},
	],
};

Thanks for twin.macro!

1reaction
ben-rogersoncommented, Aug 4, 2021

If you want something to compare your setup with, I’ve got an example using gatsby-plugin-emotion and the css prop.

Read more comments on GitHub >

github_iconTop Results From Across the Web

object-position - CSS: Cascading Style Sheets - MDN Web Docs
The object-position CSS property specifies the alignment of the selected replaced element's contents within the element's box.
Read more >
CSS object-fit Property - W3Schools
The CSS object-fit property is used to specify how an <img> or <video> should be resized to fit its container. This property tells...
Read more >
First Look At The CSS object-view-box Property
A new CSS property that will help in cropping images similar to how we use the viewBox in SVG.
Read more >
A Complete Guide to Data Attributes | CSS-Tricks
HTML elements can have attributes on them that are used for anything from ... Select any element with this data attribute and value...
Read more >
A Deep Dive Into object-fit And background-size In CSS
Before diving into CSS solutions, I want to show you how we used to do ... The default value for object-fit is fill...
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