react-css-modules

babel-plugin-react-css-modules is not matching styles with styleName

只谈情不闲聊 提交于 2019-12-10 17:47:45
问题 Issue I am trying to use babel-plugin-react-css-modules in my React project for better performance as opposed to React CSS Modules . However, the styles are being not applied correctly. Cause The version in <style> tag is wrapped with weird hypen, for example: In the <style> tag: -components-Foo-___Foo__foo___1fcIZ- On the DOM element class name: components-Foo-___Foo__foo___1fcIZ Even if we are using the same localIdentName , the generated results are different from selectors in css and

JSX element type does not have any construct or call signatures

醉酒当歌 提交于 2019-12-10 12:29:12
问题 I'm using this simple React element on the left as my root element on the page in the right. How do I fix the error shown? 回答1: This hacky typecast makes the error go away, though I don't understand it at all: const App: any = require('./components/views/app/app'); 回答2: How about: class App extends React.Component<any, any> { render() { return <div>foo</div>; } } 回答3: React expects a React.StatelessComponent from the imported App in mainScreenHelper.tsx This means that you need to provide

CSS Modules - referencing classes from other modules

笑着哭i 提交于 2019-12-10 08:48:59
问题 I have understood the concept of CSS modules so much that I am convinced that I do not want to do anything else that that for the future. Currently I am trying to refactor an existing app to use CSS modules, the app has used classic sass with BEM methodology since. Before I describe my problem I want to make clear that I undestand that I am addressing an issue that is not really within the domain of CSS modules. One should apply styles solely for usage inside a single module. At the most one

How to customise react-bootstrap components?

雨燕双飞 提交于 2019-12-09 17:02:54
问题 What is the best way to override css classes/customise react-bootstrap components? - (I have read the docs, and unless I am missing something, this isn't covered). From what I have read, it seems like it's a choice between inline styles (radium) and css modules but which is better and why? 回答1: I am not sure if this answers your question but Documentation clearly provide examples. For instance Button Props +--------+---------+--------+--------------------------------------------+ | Name |

CSS Modules - referencing classes from other modules

假装没事ソ 提交于 2019-12-05 17:48:47
I have understood the concept of CSS modules so much that I am convinced that I do not want to do anything else that that for the future. Currently I am trying to refactor an existing app to use CSS modules, the app has used classic sass with BEM methodology since. Before I describe my problem I want to make clear that I undestand that I am addressing an issue that is not really within the domain of CSS modules. One should apply styles solely for usage inside a single module. At the most one should compose CSS classes with other CSS classes of other modules. But basically: You build an (HTML-

How to customise react-bootstrap components?

廉价感情. 提交于 2019-12-04 05:07:05
What is the best way to override css classes/customise react-bootstrap components? - (I have read the docs, and unless I am missing something, this isn't covered). From what I have read, it seems like it's a choice between inline styles (radium) and css modules but which is better and why? I am not sure if this answers your question but Documentation clearly provide examples. For instance Button Props +--------+---------+--------+--------------------------------------------+ | Name | Type | Default| Description | +--------+---------+--------+--------------------------------------------+

How to apply global styles with CSS modules in a react app?

和自甴很熟 提交于 2019-12-03 04:04:54
问题 I'm currently using CSS Modules with React for my styling. So each of my components is importing in it's component specific css file, like so: import React from 'react'; import styles from './App.css'; const example = () => ( <div className={styles.content}> Hello World! </div> ); export default example; This works fine when styling individual components, but how do I apply global styling (html, body, header tags, divs, etc.) that isn't component specific? 回答1: Since you're using the ES6

Conditional Import based on environment variable

不问归期 提交于 2019-11-30 22:26:01
I have a react component which has X options for a stylesheet to be imported which is using CSS Modules. I ideally want to have a global environment variable fetched by using e.g. process.env.THEME I can't use: import MyStyleSheet from `${process.env.THEME}/my.module.css` I can use: const MyStyleSheet = require(process.env.THEME/my.module.css); however..... import/no-dynamic-require eslint rule kicks off saying its bad. https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md All the articles and posts I read say its not possible. Surely this is a common

Use CSS Modules in React components with Typescript built by webpack

↘锁芯ラ 提交于 2019-11-29 01:19:11
I want to use the css-loader with the 'modules' option of webpack in a React application written in Typescript. This example was my starting point (they are using Babel, webpack and React). webpack config var webpack=require('webpack'); var path=require('path'); var ExtractTextPlugin=require("extract-text-webpack-plugin"); module.exports={ entry: ['./src/main.tsx'], output: { path: path.resolve(__dirname, "target"), publicPath: "/assets/", filename: 'bundle.js' }, debug: true, devtool: 'eval-source-map', plugins: [ new webpack.optimize.DedupePlugin(), new webpack.optimize.UglifyJsPlugin(