css-modules

How can I style react-datepicker?

大兔子大兔子 提交于 2021-01-26 19:24:54
问题 I'm using webpack , react-datepicker and have managed to import its css with the provided css module. import 'react-datepicker/dist/react-datepicker-cssmodules.css The component looks fine and dandy, but now I want to make it full width like the time element above it. Looking at the CSS, what it needs is for the react-datepicker-wrapper element that gets dynamically added by the library to have display: block . Any modifications I make to react-datepicker-wrapper in my own css does nothing.

Use [hash:base64:5] in JavaScript / TypeScript file

随声附和 提交于 2020-12-30 06:35:48
问题 I am using CSS Modules in an Angular Project with Webpack. I had already transformed the class names in .css and .scss files with postcss-modules. Then with posthtml-css-modules I had changed the values on the class property in html elements for his hash value defined by postcss-modules . I can say that everything is working fine 💪. Now, I have a new challenge to resolve. Angular, has a feature that allows you to change dynamically the value of class in a html element depending on a condition

Changing the CSS for a React component has effect on all other pages

心不动则不痛 提交于 2020-08-08 05:14:19
问题 I have a React component with the following files: src/components/HomePage/index.js src/components/HomePage/style.scss The component is very simple: import React from 'react'; import './style.scss'; const HomePage = () => { return ( <div className="homepage"> <h1>Landing page</h1> </div> ); }; export default HomePage; Within style.scss I am applying a style to all <h1> tags: h1 { color: #f3f3f3; font-family: "Cambria"; font-weight: normal; font-size: 2rem; } And it works as expected. However,

Nested classes not working in CSS Modules with webpack

孤人 提交于 2020-04-16 15:28:11
问题 Im using webpack and css-loader and style-loader to enable css modules in my React app. These are the following setup: Webpack config: module.exports = { mode: "development", entry: __dirname + "/app/index.js", module: { rules: [ { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }, { test: /\.css$/, use: [ "style-loader", { loader: "css-loader", options: { modules: true, localIdentName: "[name]__[local]___[hash:base64:5]" } } ] } ] }, output: { filename: "bundle.js", path: _

CSS Modules and multiple layouts/themes?

[亡魂溺海] 提交于 2020-01-24 05:01:27
问题 In my application, I have multiple theme styles (you can think of them as different, separate CSS styles files). I would like to start using the CSS modules, but I don't know even how to import my first file. Lets assume the following (simple) directory structure: layouts/ themeA/ myComponent.css themeB/ myComponent.css themeC/ myComponent.css components/ myComponent.js Depending on the user settings, I would like to pick a different CSS. That's easy to do in the browser (or on the server).

CSS Modules and multiple layouts/themes?

前提是你 提交于 2020-01-24 05:01:16
问题 In my application, I have multiple theme styles (you can think of them as different, separate CSS styles files). I would like to start using the CSS modules, but I don't know even how to import my first file. Lets assume the following (simple) directory structure: layouts/ themeA/ myComponent.css themeB/ myComponent.css themeC/ myComponent.css components/ myComponent.js Depending on the user settings, I would like to pick a different CSS. That's easy to do in the browser (or on the server).

React - Use Bootstrap globally with css modules

有些话、适合烂在心里 提交于 2020-01-17 01:53:12
问题 Pretty new to react and all that stuff, so I need some help here. I recently added the https://github.com/gajus/babel-plugin-react-css-modules plugin to my project. After some troubles I got it to work, so I can now use my local css files with my components. So far so good. Not I would like to add bootstrap for the whole application. It worked before I added the css-modules plugin... Here's are the relevant parts of my code (I guess... if I miss something let me know): index.js (entrypoint of

How to import CSS-Modules correctly with Nuxt?

北城以北 提交于 2020-01-16 17:24:29
问题 I'm using CSS Modules with Nuxt and have run into some issues when trying to import a stylesheet in my js. If I import my stylesheet directly into the... `<style module> @import './index.css'; </style>` ...everything works as expected. In my particular case I need to run a computed property to choose between two different stylesheets so instead of importing through the <style module> I need to import into <script> and implement the styles like so: <script> import foo from './index.css' export

How to adjust Capybara finders on a site using css-modules?

浪子不回头ぞ 提交于 2020-01-02 07:10:24
问题 In our automated tests, a typical line in our code might look something like: find('.edit-icon').click We're on our way to using css-modules in our project and I've been warned that class names may change dramatically. A pretty zany example is this site that uses emojis in its class names (when you inspect the page): css modules by Glenn Maddern How might I best prepare for a change this drastic? I imagine many of our specs breaking, but I am a little worried about being unable to write tests