Skip to content

Commit

Permalink
Merge pull request #180 from htdangkhoa/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
htdangkhoa committed Dec 6, 2021
2 parents 9ab1be0 + 5c2a3d1 commit 8a2e427
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,63 @@ REACT_APP_FOO=$DOMAIN/foo
REACT_APP_BAR=$DOMAIN/bar
```

## Configurations

You can store your configurations in `src/configs/client.js` for client-side, `src/configs/server.js` for server-side. `src/configs/constants.js` is for constants.

You can access the correct configuration with:

```js
import configs from 'configs/client'; // for client-side
import configs from 'configs/server'; // for server-side
import constants from 'configs/constants';

// ...
```

## Adding Styles

The starter supports CSS, SASS and [CSS modules](https://github.com/css-Modules/css-Modules) is auto enabled for all files the `[name].module.*` naming convention. I use [PostCSS](https://github.com/webpack-contrib/postcss-loader) plugin to parse CSS and add autoprefixer to your stylesheet. You can access your stylesheet with two ways.

```css
/* custom button style */

.Button {
padding: 20px;
}
```

### With CSS modules

```jsx
import styles from './styles.module.scss';

function Button() {
return <div className={styles.Button} />;
}
```

### Without CSS modules

```jsx
import './styles.scss';

function Button() {
return <div className='Button' />;
}
```

You can also add the vendor CSS frameworks or global styles, just import it through the `src/client/app/index.jsx` file (app root component). For example:

```jsx
import 'bootstrap/dist/css/bootstrap.min.css';
import '<your-global-styles>.css';

function App() {
// ...
}
```

## Adding Images, Fonts, and Files

With webpack, using static assets like images and fonts works similarly to CSS.
Expand Down

0 comments on commit 8a2e427

Please sign in to comment.