Skip to content

Use CSS Modules? #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
justin808 opened this issue Oct 31, 2015 · 7 comments
Closed

Use CSS Modules? #142

justin808 opened this issue Oct 31, 2015 · 7 comments

Comments

@justin808
Copy link
Member Author

@alexfedoseev @jbhatab @samnang @robwise @josiasds @mapreal19 @dylangrafmyre Worth considering!

@jbhatab
Copy link
Member

jbhatab commented Oct 31, 2015

This blog was great on ICSS. http://glenmaddern.com/articles/interoperable-css. I think it's the matching blog to the video.

I'm definitely on board.

@robwise
Copy link
Contributor

robwise commented Oct 31, 2015

The cool thing about doing it this way is that you can put the styling for your "bundle" (here meaning a folder within client/app/bundles) with the actual bundle, which is cool for organization as well as for modularity (meaning it's easier to extract the component for reuse components across apps, if you wanted to).

@rstudner
Copy link
Contributor

I've used this css bundle technique. It is very handy

@justin808
Copy link
Member Author

Had great chat with @alexfedoseev. Looks like this can work. @jbhatab, you'll be proven right about creating the CSS within Webpack. Here's the steps:

  • Update the bootstrap-sass-loader so that it wraps the resulting sass in :global {}. See Add global wrapper for CSS Modules bootstrap-sass-loader#36
  • We'll need a new webpack config file to build the extracted CSS along with fingerprinting the corresponding assets, written to the /public/ directories (what's the directory structure within /public?).
  • Update assets.rake so that it adds another line, like this, plus updating the clobber task:
  desc "Compile assets with webpack"
  task :webpack do
    sh "cd client && npm run build:client"
    sh "cd client && npm run build:server"
    sh "cd client && npm run build:css_assets"
  end

@justin808
Copy link
Member Author

@alexfedoseev and I are working on: https://github.com/shakacode/bootstrap-loader/tree/alex/bootstrap-4. We'll be adding CSS modules here shortly.

@justin808
Copy link
Member Author

Done! this is in master!

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

No branches or pull requests

4 participants