Comments (8)
@superkat64 - That's already configured in master. https://github.com/coryhouse/react-slingshot/blob/master/webpack.config.prod.js#L129
from react-slingshot.
@coryhouse Thank you so much! I must have removed it trying to figure it all out on accident or I'm just blind. Really appreciate the quick response
Edit: I was looking at the wrong config file the whole time 😓
from react-slingshot.
Does it work fine with npm start
?
I ask because that behavior hasn't changed.
Only npm run build
uses the ExtractTextPlugin to generate a separate CSS file.
from react-slingshot.
hey @coryhouse yes it does. I believe there might be a problem with the way im doing it (sorry, im new to webpack). In contrast, here is a version that works in my other projects using webpack:
{ test: /\.scss$/, loader: "style!css!sass?includePaths[]=" + bourbon},
But im not sure how to do it with ExtractTextPlugin. I'll try a few things later this week and report back, so far I have simply included bourbon in the styles folder and important it manually, but would be way better to have it globally and simply use @import 'bourbon'
from react-slingshot.
Yesterday I coincidentally hit the same wall. On a separate project I'm trying to get @import to work within a CSS file that I'm loading via Webpack. Let me know if/when you have any luck, and I'll do the same.
from react-slingshot.
I did some googling on the web and found
const sassPaths = bourbon
.includePaths
.map((sassPath)=>`includePaths[]=${sassPath}`)
.join('&');
and
const sassPaths = bourbon
.with([
path.resolve(__dirname,'./src/styles')
])
.map((sassPath)=>`includePaths[]=${sassPath}`)
.join('&');
this type of code. which on my testing seemed to work.
thus the loaders were
if(env === productionEnvironment){
loaders.push({
test: /(\.css|\.scss)$/,
include: path.join(__dirname, 'src'),
loader: ExtractTextPlugin.extract(`css?sourceMap!postcss!sass?sourceMap&${sassPaths}`)
});
}else{
loaders.push({
test: /(\.css|\.scss)$/,
include: path.join(__dirname, 'src'),
loaders: ['style', 'css?sourceMap', 'postcss', `sass?sourceMap&${sassPaths}`]
});
}
from react-slingshot.
@darcnite3000 that solution worked for me. Thanks!
from react-slingshot.
Hey hey!
Do we happen to have the solution for configuring webpack to use MiniCssExtractPlugin
now that Webpack 4 doesn't use ExtractTextPlugin
anymore. I've been tinkering with my app and also have been receiving the same File to import not found or unreadable: stylesheets/variables
error.
Currently, this is the only change I've made:
plugins: [
// .. the other plugins
new MiniCssExtractPlugin()
],
module: {
rules: [
{
test: /(\.css|\.scss|\.sass)$/,
use: [
{
loader: MiniCssExtractPlugin.loader
},
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'postcss-loader',
options: {
plugins: () => [require('autoprefixer')],
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {
includePaths: [path.resolve(__dirname, 'src', 'scss')],
sourceMap: true
}
}
]
},
I appreciate any help, webpack is still foreign territory for me but I'm trying to get more familiar with it. Will keep googling in the meantime
from react-slingshot.
Related Issues (20)
- Use redux-saga
- npm run remove-demo doesn't work
- Terminal font becomes invisible after npm start
- Error running 'npm install' HOT 1
- Switch Redux logic setup to use Redux Toolkit HOT 4
- Involving Database HOT 4
- why there are yarn.lock and package-lock.json both present? HOT 6
- Implementation of redux-persist with react-slingshot HOT 5
- [WARNING] Removing the demo app also removes files that do not belong to the demo app
- Get error when execute "npm start" command. HOT 1
- Required Information about peripheral files. HOT 2
- Update README about python version HOT 1
- Refused to execute inline script because it violates the following Content Security Policy directive:
- facing issue while npm run setup HOT 2
- Opentest issue
- npm run on production environment
- Add Flow please
- npm ERR! [email protected]
- jest: not found
- Build 16x fails not 18x or 20x
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 react-slingshot.