Comments (4)
Thank you, I'm glad it has been useful to you so far.
Regarding CSS files... Obviously there are many ways to approach CSS files.
If I were to add plain old stylesheets to this, the first thing I would do would be to get inline stylesheets working. The webpack page at http://webpack.github.io/docs/stylesheets.html has the instructions for this.
I would edit my webpack.config.dev.js
file to include the css loader as shown in the configuration section of the link above.
That will allow you to "include" a stylesheet when your component is used. In your component
Then in my components.js
file, I would conditionally include my stylesheet. See https://gist.github.com/khtdr/bd99c772548203a0f540 for an example that might work.
This should tell webpack to put that stylesheet inline when using that component. The counter example is probably not the best example since I tried to reduce the number of files being used, you are probably organizing things differently, but the idea is the same.
You should not have to muck with the Makefile to get stylesheets to work in this manner. Then you could work at getting the included as separate files. If you configure webpack to build those and copy them to the public
directory, then you shouldn't have to change the Makefile even then. (the public directory only exists when building the app for prod, in dev it serves from memory I believe).
Hopefully this can get you further along. If you have more trouble, fork my repo and commit your changes to your fork and I can get a better idea of what you are doing.
Good luck :)
from redux-react-koa-isomorphic-counter-example.
Many thanks for your detailed answer. My mistake was to require the css file regardless of whether the code was for the client or the server.
Many thanks again.
from redux-react-koa-isomorphic-counter-example.
In the process of checking whether we are on the client/server before requiring the css file, I realized that you define __CLIENT__
and __SERVER__
variables on the window
object client-side and on the global
object server-side. As these are not polyfilled in both environments they cannot be used straight away. Why not use a variable on process.env
through the webpack define plugin ? For example :
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
CLIENT: JSON.stringify(true)
}
})
and then
if (process.env.CLIENT) require('./style.css')
from redux-react-koa-isomorphic-counter-example.
You are right. I think I put those in early on, thinking, "I might want these", and then never used them, so I never went back and cleaned them up.
from redux-react-koa-isomorphic-counter-example.
Related Issues (20)
- Consider updating to Redux 1.0 RC HOT 2
- An in-range update of webpack-dev-server is breaking the build 🚨 HOT 8
- An in-range update of react-hot-loader is breaking the build 🚨 HOT 10
- An in-range update of koa is breaking the build 🚨 HOT 6
- An in-range update of react-redux is breaking the build 🚨 HOT 4
- An in-range update of nodemon is breaking the build 🚨 HOT 3
- An in-range update of webpack-cli is breaking the build 🚨 HOT 3
- An in-range update of babel7 is breaking the build 🚨
- An in-range update of babel7 is breaking the build 🚨 HOT 22
- An in-range update of react is breaking the build 🚨 HOT 5
- An in-range update of nunjucks is breaking the build 🚨 HOT 1
- An in-range update of babel-loader is breaking the build 🚨 HOT 1
- An in-range update of koa-bodyparser is breaking the build 🚨 HOT 1
- redux 2.0 HOT 3
- An in-range update of webpack-cli is breaking the build 🚨 HOT 1
- An in-range update of babel7 is breaking the build 🚨 HOT 1
- An in-range update of webpack is breaking the build 🚨 HOT 4
- An in-range update of babel7 is breaking the build 🚨
- An in-range update of webpack is breaking the build 🚨 HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-react-koa-isomorphic-counter-example.