-
-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] source-maps with css or sass? #7
Comments
I am using this together with ExtractTextPlugin to output |
I'm trying node-sass |
I have it sort of working, with ExtractTextPlugin no less @glebm
|
@jeffling are you sure sass source maps are supported? |
@nickdima you're right, it's basically just the compiled css. The original question asked for 'traced back to the source scss file', and so far I got the filename, not the actual sass code. It's helpful, but it would be nice to be able to use chrome workspaces to directly edit the file though. |
The reason source maps are not supported is that
Maybe we should specify this in the readme? cc @akiran @jhnns |
gulp-sass had a similar problem dlmanning/gulp-sass#8 Can we follow similar approach to sass-loader also ? |
I was also looking at this approach, I can try to make a PR. |
@nickdima Thanks |
fixes #30 fixes webpack/webpack#214
OK, a quick update on this. The approach is doable the only barrier being that |
Work in progress here |
@nickdima @offminded Any updates? |
We should check if this is possible with the current beta version of node-sass. The current master branch is already using node-sass 2.0, so we can start playing with it now. |
This works for me:
|
It almost works... With aboves config Chrome displays "stdin" as the source. File name and path is missing. You need to change "sass-loader/index.js":
After this change you can map the source in Chrome's workspace and edit / save the file in Chrome as well. Could you add this to the official NPM release? Thanks! |
I can confirm the solution from @kyle-johnson. Thanks! |
Has been published as |
How are you guys live reloading the css when using |
I use two different configurations (dev and prod).
|
But on dev you would want both source maps and hot/live reloading. How do you do that? |
@nickdima did you ever find a solution to this? I would really like hot/live reloading if posible, it's such a nice feature. |
@nickdima @Todilo what I've been doing is to just use webpack in watch mode instead of dev-server, and using http://livejs.com/ (or fb's flo or any other css reload plugin) to get live reloading. |
@jeffling ok, I was thinking of look into if there was a tool for that instead since I do not use the dev-server atm (getting everything working isomorphic in mvc5 is no simple task). Thank you I will try livejs.com. Guess I only need the css changes updates as reloading entire page when working with SPA seems like a bad idea. Only downside is that the scss sourcemap is not updated, any way to deal with that? |
@Todilo if you use inline source maps, it should be updated I think. |
@jeffling dont know how to set that up. However since I do most development in Chrome I setup a mapping from the the .scss from the server to the local location on the filesystem. Then I can both make changes in the browser(directly changin the scss files) as well as make changes in visual studio. Still if I make changes in VS I dont get updated .scss file but well, whatever :) (if you dont have an easy guide on how to set tha tup). Edit: Now I read the documentation again and saw the setting you were talking about: Now it works perfectly. I can change the sourcecode from .scss / browser and everything is updated live as well as correctly! Perfect! |
|
Thanks, this works indeed @kyle-johnson. But it doesn't if you would like to use React-Css-Modules. Any ideas? http://stackoverflow.com/questions/34434849/how-to-get-sourcemaps-working-for-react-css-modules |
I started with what @kyle-johnson provided and then made it so it still had HMR in dev mode. var isDevelopment = process.env.ASPNETCORE_ENVIRONMENT === 'Development', //Replace with whatever you're using to determine if this is a dev env
extractCSS = new ExtractTextPlugin('site.css', {disable: isDevelopment}),
sassLoader = [
'css'+(isDevelopment? '?sourceMap=true': ''),
'postcss',
'sass'+(isDevelopment? '?outputStyle=expanded&sourceMap=true&sourceMapContents=true': '')
];
if(isDevelopment) sassLoader.unshift('style');
var config = {
module: {
loaders: [
{ test: /\.scss/, loader: extractCSS.extract(sassLoader) },
]
},
plugins: [
extractCSS
]
};
if(isDevelopment) config.devtool = 'inline-source-map'; |
Here's what I did:
or `loader: ExtractTextPlugin.extract('style-loader', 'css-loader?sourceMap!sass-loader?config=sassLoader'), sassLoader: {
Here's what my webpack.config.js looks like: `var path = require('path'); var ExtractTextPlugin = require("extract-text-webpack-plugin"); module.exports = {
};` |
this is directly from my config. (ejected create-react-app) it works just fine for me. You need to add |
I was able to get it working by doing the following:
|
@shannonsumner And do you find that your css was not compiled when you use disable option in new ExtractTextPlugin? |
@xuyongli I don't think I tried with disable: true |
Hi,
I am using sass-loader to compile sass code. Can we have the source-map to trace back the source file with webpack for sass?
Currently, I setup Sass-loader by
with
Is it possible to trace back the source sass file in chrome dev tools?
The text was updated successfully, but these errors were encountered: