vercel / next-plugins

Official Next.js plugins
MIT License
2.68k stars 319 forks source link

localIdentName support in next-css? #15

Closed thekevinscott closed 6 years ago

thekevinscott commented 6 years ago

Hi there,

Is localIdentName passable as an option to the webpack css loader? (It doesn't look like it from the code but I may be missing something).

We have a custom localIdentName convention that allows our designers to pass back feedback to the dev team. I'd like to get that working in our Next.js app.

I put together a PR in case this is something that doesn't exist but would be useful.

gihrig commented 6 years ago

@thekevinscott I definitely have a need for this functionality. but I world prefer to do it in postcss.config.js.

I have been trying to figure out how to do this with next-css. I've taken the approach of using PostCSS to pass options to cssModules, which has worked well, so far.

I did it this way because I intend to use 'postcss-cssnext', in addition to 'postcss-modules' and I would rather have all of that configuration in one place.

(snip)

I didn't see that your modification in #16 included that final step, or did I miss something?

That was because including 'postcss-modules' in postcss.config.js results in an empty string being returned in the React component. e.g. className={styles.hello} === ''. Even when there is no config passed to 'postcss-modules'.

(snip)

Edit: I did have great success with your mod in #16. ✨

timneutkens commented 6 years ago

As per #16 this will soon be possible using cssLoaderOptions