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.

Problems with require([styles])

See original GitHub issue

I’m building spectacle presentation with Brunch. There are problem here. Brunch can’t handle requireing of styles properly, so I get an error:

image

The cause of problem is that spectacle/lib/components/component-playground.js require styles, Brunch doesn’t require.registers them as modules, so error occurs. Here’s where we have problems:

import "../themes/default/playground.css";
import "../themes/default/codemirror.css";

// ...

  if (useDarkTheme) {
    require("../themes/default/dark.codemirror.css");
  } else {
    require("../themes/default/light.codemirror.css");
  }

These problems present with spectacle@^2, in case with ^1 everything works fine because of Radium.

Could you, please, consider replacement of these require by simple <style> tags in HTML or with some kind of css-in-js library (Radium in your case)? Keep in mind that this problem weren’t present prior to ^2, so people that use Spectacle with other build systems can’t upgrade to new fancy version because of that.

Also, I understand, particularly this is problem with Brunch itself since it doesn’t consider css files as modules. We, at Brunch team, are considering it. Here are related issues: brunch/brunch#1684 and brunch/brunch#1473.

Besides, thanks for amazing presentation framework! Really awesome job!

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
kittencommented, Nov 2, 2017

@ryan-roemer those other CSS imports are gone in the new react-live based version 😉

Edited to add some proof: https://github.com/FormidableLabs/spectacle/blob/master/src/components/component-playground.js#L1-L4

0reactions
denysdovhancommented, Nov 10, 2017

Seems like legit. Thanks for the great support!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Errors - RequireJS
This page lists errors that are generated by RequireJS. If the following information does not fix the problem, you can ask on the...
Read more >
Typescript code not working with commonjs style require ...
When you get the No overload matches this call. error, means you are defining parameters that do not exist on that type.
Read more >
Reccomended way to require CSS in webpack? #176 - GitHub
I am using the scss into my project. I have added css like import 'style!react-select/scss/default.scss'; but it is not working because element ...
Read more >
Handling common HTML and CSS problems - MDN Web Docs
Some of the trouble with HTML and CSS lies with the fact that both languages are fairly simple, and often developers don't take...
Read more >
Solving the React Error: Not Picking Up CSS Style | Pluralsight
CSS helps in styling webpages, but sometimes code may not get properly imported or may show a few errors while it is being...
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