Support to resolve index.css
See original GitHub issueHey 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:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 thepackage.json
main
field. Also uses theextensions
option to check the file extensions, so you may usecomposes: A from 'style/typography/medium';
.Small implementation details. Require hooks uses now resolve-imports plugin instead of
parser
plugin.@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 theresolve-imports
plugin.I thought about adding option
resolve
, but looks like specifyingextensions
andresolve.extensions
twice would be annoying 😃