@@ -88,97 +88,6 @@ To use the UMD bundle, choose either the font or svg icon bundle and a new
88
88
Check out the #material-icons package for more information about the separate
89
89
icon components.
90
90
91
- ## Pre-compiling the base react-md styles for quicker builds
92
-
93
- The initial build for ` react-md ` styles can take awhile since it does a lot
94
- behind the scenes to validate the different colors, contrast ratios, and other
95
- things to prevent errors. Since you won't really be changing the ` react-md `
96
- styles much once you've defined your theme or other custom overrides, you can
97
- speed up this process by just pre-building the base ` react-md ` CSS file. If you
98
- are using all the default "feature flags" within ` react-md ` , you can use one of
99
- the [ CDN hosted pre-compiled themes] ( /guides/cdn-links#pre-compiled-themes ) .
100
-
101
- If you have changed more than just the color variables and the light/dark theme
102
- toggle, you'll need to manually compile the base ` react-md ` styles yourself. The
103
- [ including styles without webpack] guide will go into full details for this, but
104
- here's a quick version.
105
-
106
- First, install ` node-sass ` if you haven't already:
107
-
108
- ``` sh
109
- npm install --save-dev node-sass
110
- ```
111
-
112
- Or with ` yarn ` :
113
-
114
- ``` sh
115
- yarn add --dev node-sass
116
- ```
117
-
118
- Next, create a new ` src/react-md.scss ` file that will import the ` react-md `
119
- library along with your variable overrides:
120
-
121
- ``` scss
122
- @import " ./my-custom-variables" ;
123
-
124
- // or just define them in this file
125
- $rmd-list-vertical-padding : 0.565rem ;
126
- $rmd-icon-use-font-icons : false;
127
- $rmd-icon-icon-spacing-with-text : 0.75rem ;
128
-
129
- @import " react-md/dist/scss/styles" ;
130
- ```
131
-
132
- > Note that there is no leading tilde (` ~ ` ) for the ` @import ` statement for the
133
- > react-md styles file along with now being ` dist/scss ` instead of just ` dist ` .
134
- > This is to work without webpack.
135
-
136
- Next, create a new script in your ` package.json ` to compile the base styles:
137
-
138
- ``` diff
139
- "scripts": {
140
- "start": "react-scripts start",
141
- + "styles": "node-sass --include-path=node_modules src/react-md.scss src/react-md.css",
142
- "build": "react-scripts build",
143
- "test": "react-scripts test",
144
- "eject": "react-scripts eject"
145
- },
146
- ```
147
-
148
- > Note that ` node-sass ` is run with ` --include-path=node_modules ` . This is
149
- > required now that it is being compiled without webpack.
150
-
151
- Run the new ` styles ` script to generate your ` src/index.css ` file:
152
-
153
- ``` sh
154
- npm run styles
155
- ```
156
-
157
- Or with ` yarn ` :
158
-
159
- ``` sh
160
- yarn styles
161
- ```
162
-
163
- Finally, update the ` src/index.js ` to include the newly created ` react-md.css `
164
- file:
165
-
166
- ``` diff
167
- + import './react-md.css';
168
- import React from 'react';
169
- import ReactDOM from 'react-dom';
170
- import './index.css';
171
- import App from './App';
172
- import * as serviceWorker from './serviceWorker';
173
- ```
174
-
175
- You're done! The normal build process will now include the newly compiled
176
- ` react-md.css ` file and handle the auto-prefixing based on the ` browserlist ` .
177
- Depending on your preference, you can commit this generated file to ` git ` if you
178
- know it won't change much, add a ` postinstall ` script to automatically generate
179
- this file for you, or use something like [ npm-run-all] to run the ` styles `
180
- command before the ` react-scripts start ` .
181
-
182
91
## Self-hosting the fonts
183
92
184
93
Sometimes it might not be ideal to use [ Google Fonts] for providing the fonts
0 commit comments