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
{{ message }}
This repository was archived by the owner on Jan 31, 2025. It is now read-only.
I spent way too long banging my head against my desk unsure of why my page wasn't rendering with source maps. I finally found out that you need to have both a link and a require statement for this to work properly.
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -19,11 +19,12 @@ var css = require('!css!sass!./file.scss');
19
19
// => returns compiled css code from file.scss, resolves imports and url(...)s
20
20
```
21
21
22
-
Use in tandem with the [`style-loader`](https://github.com/webpack/style-loader) to add the css rules to your document:
22
+
Use in tandem with the [`style-loader`](https://github.com/webpack/style-loader)and [`css-loader`](https://github.com/webpack/css-loader)to add the css rules to your document:
23
23
24
24
```javascript
25
25
require('!style!css!sass!./file.scss');
26
26
```
27
+
*NOTE: If you encounter module errors when requiring scss files, make sure you have installed the required node module for each additional loader you use.*
27
28
28
29
### Apply via webpack config
29
30
@@ -135,6 +136,7 @@ module.exports = {
135
136
]
136
137
};
137
138
```
139
+
You will need to reference your app's scss file using ```require('/.file.scss')``` and you will need to add a link tag to your mapping CSS ```<link rel="stylesheet" href="styles.css" />```
138
140
139
141
If you want to edit the original Sass files inside Chrome, [there's a good blog post](https://medium.com/@toolmantim/getting-started-with-css-sourcemaps-and-in-browser-sass-editing-b4daab987fb0). Checkout [test/sourceMap](https://github.com/jtangelder/sass-loader/tree/master/test) for a running example. Make sure to serve the content with an HTTP server.
0 commit comments