Skip to content

Instantly share code, notes, and snippets.

@a-x-
Last active March 1, 2018 15:08
Show Gist options
  • Select an option

  • Save a-x-/c81cc1391fce44c39434e609a0be9549 to your computer and use it in GitHub Desktop.

Select an option

Save a-x-/c81cc1391fce44c39434e609a0be9549 to your computer and use it in GitHub Desktop.
Building css-modules library

🚫 Approach 1: converted plain css

pros:

  • much simple lib build

cons:

  • additional requirements to service build config (style-loader, css-loader for node_modules)
  • bug: every library's css file got style tag in a project 😨
  • bug: postcss-icss-selectors rule.parent is undefined β€” UPD fix
  • bug: css-modules-transform generateScopedName does not work β€” UPD fix
  • bug: generateScopedName does not apply to postcss optimized selectors β€” issue

todo:

  • babel-plugin-css-modules-transform preprocessCss + keepImport config
  • script for preprocessCss that should use postcss api

questions:

  • can create-react-app work well with import '*.css' under node_modules? β€” NO

Approach 2: complete js bundles with css

pros:

  • easy to use

cons:

  • jss runtime
  • prefined build

todo:

  • create babel plugin that will:
  • install jss as peed-dep (because mui uses it too)

questions:

  • can webpack extract jss style-objects from calls to static files? (dig into ExtractTextPlugin underhood details)
  • postcss async mitigation, postcss.async()
@a-x-

a-x- commented Feb 28, 2018

Copy link
Copy Markdown
Author

@a-x-

a-x- commented Mar 1, 2018

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment