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.

Support to resolve index.css

See original GitHub issue

Hey there,

I’ve been using this library for a while now and it has been working very well. But I started on a new project, where they organise some of their CSS on folders, like this:

/style/typography/index.css
/style/typography/medium.css
/style/typography/large.css

So we can compose like:

.item {
  /* webpack can resolve the index.css for you */
  composes: size-sm bold from 'style/typography';
  
  /* or you can compose the file directly */
  composes: size-md from 'style/typography/medium';
}

That works fine on webpack, but this hook does not try to resolve index.css files if the given path is a folder. Is it possible to add such feature? I could try to submit a PR to include this.

Let me know!

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sullenorcommented, Mar 5, 2017

@lucasmotta hello,

I published a beta version to try it out (unfortunately haven’t tested it thoroughly yet). You may try it out with npm install css-modules-require-hook@4.1.0-beta.

It should check the index.css file if you point a directory and also will check the package.json main field. Also uses the extensions option to check the file extensions, so you may use composes: A from 'style/typography/medium';.

Small implementation details. Require hooks uses now resolve-imports plugin instead of parser plugin.

0reactions
sullenorcommented, Mar 14, 2017

@lucasmotta the branch name is demo.

Actually the options haven’t changed (haven’t thought about public api). Mostly, I changed the set of plugins and passed the existing extensions option to the resolve-imports plugin.

I thought about adding option resolve, but looks like specifying extensions and resolve.extensions twice would be annoying 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

15 - Stack Overflow
I am trying to run the file but it is not working I have checked all the spelling also try to add a...
Read more >
"Cannot resolve module" for CSS files · Issue #1470 - GitHub
When I try to require CSS files, I get an error: ERROR in ./src/client/scripts/display-test.js Module not found: Error: Cannot resolve ...
Read more >
css-loader | webpack - JS.ORG
The css-loader interprets @import and url() like import/require() and will resolve them.
Read more >
Replacing index.css with index.scss and Storybook issue
It seems that Redwood's Storybook configuration is expecting an index.css file in the root of the web side. We had added Sass and...
Read more >
CSS - Parcel
Parcel includes support for CSS out of the box. ... index.css'; ... This means that the custom property could resolve to different URLs...
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