You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-6Lines changed: 12 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -33,12 +33,14 @@ This will run the automated build process, start up a webserver, and open the ap
33
33
3. On a Mac? You're all set. If you're on Linux or Windows, complete the steps for your OS below.
34
34
35
35
**On Linux:**
36
-
Run this to [increase the limit](http://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc) on the number of files Linux will watch. [Here's why](https://github.com/coryhouse/react-slingshot/issues/6).
36
+
37
+
* Run this to [increase the limit](http://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc) on the number of files Linux will watch. [Here's why](https://github.com/coryhouse/react-slingshot/issues/6).
37
38
`echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p`
38
39
39
-
**On Windows:**
40
-
1.**Install [Python 2.7](https://www.python.org/downloads/)**. Browser-sync (and various other Node modules) rely on node-gyp, which requires Python on Windows.
41
-
2.**Install C++ Compiler**. [Visual Studio Express](https://www.visualstudio.com/en-US/products/visual-studio-express-vs) comes bundled with a free C++ compiler. Or, if you already have Visual Studio installed: Open Visual Studio and go to File -> New -> Project -> Visual C++ -> Install Visual C++ Tools for Windows Desktop. The C++ compiler is used to compile browser-sync (and perhaps other Node modules).
40
+
**On Windows:**
41
+
42
+
***Install [Python 2.7](https://www.python.org/downloads/)**. Browser-sync (and various other Node modules) rely on node-gyp, which requires Python on Windows.
43
+
***Install C++ Compiler**. [Visual Studio Express](https://www.visualstudio.com/en-US/products/visual-studio-express-vs) comes bundled with a free C++ compiler. Or, if you already have Visual Studio installed: Open Visual Studio and go to File -> New -> Project -> Visual C++ -> Install Visual C++ Tools for Windows Desktop. The C++ compiler is used to compile browser-sync (and perhaps other Node modules).
42
44
43
45
##FAQ
44
46
###Why does this exist?
@@ -100,13 +102,15 @@ Webpack serves your app in memory when you run `npm start`. No physical files ar
100
102
Magic! Okay, more specifically, we're handling it differently in dev (`npm start`) vs prod (`npm run build`)
101
103
102
104
When you run `npm start`:
105
+
103
106
1. The sass-loader compiles Sass into CSS
104
107
2. Webpack bundles the compiled CSS into bundle.js. Sounds odd, but it works!
105
108
3. bundle.js contains code that loads styles into the <head> of index.html via JavaScript. This is why you don't see a stylesheet reference in index.html. In fact, if you disable JavaScript in your browser, you'll see the styles don't load either.
106
109
107
110
The approach above supports hot reloading, which is great for development. However, it also create a flash of unstyled content on load because you have to wait for the JavaScript to parse and load styles before they're applied. So for the production build, we use a different approach:
108
111
109
112
When you run `npm run build`:
113
+
110
114
1. The sass-loader compiles Sass into CSS
111
115
2. The [extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin) extracts the compiled Sass into styles.css
112
116
3. buildHtml.js adds a reference to the stylesheet to the head of index.html.
@@ -117,7 +121,8 @@ For both of the above methods, a separate sourcemap is generated for debugging S
117
121
No problem. Reference your CSS file in index.html, and add a step to the build process to copy your CSS file over to the same relative location /dist as part of the build step. But be forwarned, you lose style hot reloading with this approach.
118
122
119
123
### I just want an empty starter kit.
120
-
This starter kit includes an example app so you can see how everything hangs together on a real app. To create an empty project, you can delete the following:
124
+
This starter kit includes an example app so you can see how everything hangs together on a real app. To create an empty project, you can delete the following:
125
+
121
126
1. Components in src/components
122
127
2. Styles in src/styles/styles.scss
123
128
3. Delete files in src/businessLogic
@@ -156,7 +161,8 @@ Since browsers don't currently support ES6, we're using Babel to compile our ES6
156
161
157
162
Also note that no actual physical files are written to the filesystem during the dev build. **For performance, all files exist in memory when served from the webpack server.**. Physical files are only written when you run `npm run build`.
158
163
159
-
**Tips for debugging via sourcemaps:**
164
+
**Tips for debugging via sourcemaps:**
165
+
160
166
1. Browsers vary in the way they allow you to view the original source. Chrome automatically shows the original source if a sourcemap is available. Safari, in contrast, will display the minified source and you'll [have to cmd+click on a given line to be taken to the original source](http://stackoverflow.com/questions/19550060/how-do-i-toggle-source-mapping-in-safari-7).
161
167
2. Do **not** enable serving files from your filesystem in Chrome dev tools. If you do, Chrome (and perhaps other browsers) may not show you the latest version of your code after you make a source code change. Instead **you must close the source view tab you were using and reopen it to see the updated source code**. It appears Chrome clings to the old sourcemap until you close and reopen the source view tab. To clarify, you don't have to close the actual tab that is displaying the app, just the tab in the console that's displaying the source file that you just changed.
162
168
3. If the latest source isn't displaying the console, force a refresh. Sometimes Chrome seems to hold onto a previous version of the sourcemap which will cause you to see stale code.
0 commit comments