Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #2278
Closed
Open
Issue created May 20, 2017 by Administrator@rootContributor

Add support for CSS Modules with explicit filename

Created by: ro-savage

I suggest adding support for CSS Modules with an explicit filename, allowing those who wish to use CSS Modules to do so without interfering with importing regular stylesheets including from external packages.

What is CSS Modules CSS Modules will autogenerate a classname with hash to insure scoped classnames. This means that you no longer have to worry about clashing classnames or using BEM or similar naming convention. It does this in the background when CSS is being generated.

To quote CSS Modules: No more conflicts, explicit dependencies, no global scope.

Explicit file name [name].modules.css

Regex CSS Module: /\.modules.css$/ Not Module: /[^\.modules]\.css$/

Reasoning CSS Modules is widely used, has excellent satisfaction (97%) according to StateOfJS. It also allows an easy alternative with IDE support from CSSinJS solutions and wont interfere with regular css.

Opt-in only The feature would be entirely optional and a user would have to explicitly opt in by using the naming convention and importing the css file into a JS file.

Gotchas If someone named a stylesheet [something].modules.css without it actually being a CSS Module and imported it, it would be imported as a CSS Module.

Pull Request PR #2285

Thoughts?

Assignee
Assign to
Time tracking