Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit 98c5d38

Browse files
committed
Help avoid common pitfalls
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.
1 parent 74deeb7 commit 98c5d38

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ var css = require('!css!sass!./file.scss');
1919
// => returns compiled css code from file.scss, resolves imports and url(...)s
2020
```
2121

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:
2323

2424
``` javascript
2525
require('!style!css!sass!./file.scss');
2626
```
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.*
2728

2829
### Apply via webpack config
2930

@@ -135,6 +136,7 @@ module.exports = {
135136
]
136137
};
137138
```
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" />```
138140

139141
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.
140142

0 commit comments

Comments
 (0)