Skip to content

Commit add82bf

Browse files
committedJan 8, 2020
feat(css): add tsdx config for PostCSS, organize CSS and SASS imports
1 parent 4094600 commit add82bf

6 files changed

+32
-4
lines changed
 

‎.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tsdx.config.js

‎package.json

+3
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@
8181
"@types/tinymce": "~4.5.23",
8282
"@typescript-eslint/eslint-plugin": "~2.15.0",
8383
"@typescript-eslint/parser": "~2.15.0",
84+
"autoprefixer": "~9.7.3",
8485
"awesome-typescript-loader": "~5.2.1",
8586
"babel-loader": "~8.0.6",
8687
"bootstrap": "~4.4.0",
8788
"commitizen": "~4.0.3",
8889
"commitlint-config-cz": "0.12.1",
8990
"coveralls": "~3.0.6",
9091
"cross-env": "~6.0.3",
92+
"cssnano": "~4.1.10",
9193
"cz-conventional-changelog": "~3.0.2",
9294
"enzyme": "~3.11.0",
9395
"enzyme-adapter-react-16": "~1.15.2",
@@ -110,6 +112,7 @@
110112
"react-docgen": "~5.1.0",
111113
"react-docgen-typescript-loader": "~3.6.0",
112114
"react-dom": "~16.12.0",
115+
"rollup-plugin-postcss": "~2.0.3",
113116
"sass-loader": "~8.0.0",
114117
"semantic-release": "~15.14.0",
115118
"sinon": "~8.0.1",

‎scss/main.scss

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
/* Import bootstrap */
66

7-
@import "node_modules/bootstrap/scss/bootstrap";
7+
@import "node_modules/bootstrap/scss/bootstrap";
8+
9+
/* Other CSS Imports */
10+
11+
@import '../node_modules/react-toastify/dist/ReactToastify.min.css';

‎stories/textfield.stories.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react'
33
import { storiesOf } from '@storybook/react'
44

55
import { TextField } from '../src'
6-
import 'bootstrap/dist/css/bootstrap.min.css'
76

87
storiesOf('TextField', module)
98
.addParameters({

‎stories/toaster.stories.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { storiesOf } from '@storybook/react'
44

55
import Button from 'react-bootstrap/Button'
66
import { Toast, Toaster } from '../src'
7-
import 'bootstrap/dist/css/bootstrap.min.css'
8-
import 'react-toastify/dist/ReactToastify.min.css'
97

108
storiesOf('Toaster', module)
119
.addParameters({

‎tsdx.config.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const postcss = require('rollup-plugin-postcss')
2+
const autoprefixer = require('autoprefixer')
3+
const cssnano = require('cssnano')
4+
5+
module.exports = {
6+
rollup(config, options) {
7+
config.plugins.push(
8+
postcss({
9+
plugins: [
10+
autoprefixer(),
11+
cssnano({
12+
preset: 'default',
13+
}),
14+
],
15+
inject: false,
16+
// only write out CSS for the first bundle (avoids pointless extra files):
17+
extract: !!options.writeMeta,
18+
modules: true,
19+
}),
20+
)
21+
return config
22+
},
23+
}

0 commit comments

Comments
 (0)
Please sign in to comment.