Skip to content

CSS Modules local class names for Create React App #3549

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
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/react-scripts/template/src/App.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
.App {
:local .component {
text-align: center;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
}

.App-header {
:local .component > header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;
}

.App-title {
:local .component > header > img {
animation: logo-spin infinite 20s linear;
height: 80px;
}

:local .component h1 {
font-size: 1.5em;
}

.App-intro {
:local .component p {
font-size: large;
}

@keyframes App-logo-spin {
@keyframes :local(logo-spin) {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
12 changes: 6 additions & 6 deletions packages/react-scripts/template/src/App.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import styles from './App.css';

class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
<div className={styles.component}>
<header>
<img src={logo} alt="logo" />
<h1>Welcome to React</h1>
</header>
<p className="App-intro">
<p>
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
Expand Down