sass-loader 6.0.2 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +232 -70
- package/LICENSE +1 -1
- package/README.md +67 -53
- package/lib/importsToResolve.js +13 -4
- package/lib/loader.js +8 -4
- package/package.json +46 -29
- package/.editorconfig +0 -15
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -9
- package/.npmignore +0 -19
- package/.travis.yml +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,120 +1,282 @@
|
|
|
1
|
-
|
|
2
|
-
---------
|
|
1
|
+
# Change Log
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
<a name="6.0.6"></a>
|
|
6
|
+
## [6.0.6](https://github.com/webpack-contrib/sass-loader/compare/v6.0.5...v6.0.6) (2017-06-14)
|
|
7
7
|
|
|
8
|
-
###
|
|
8
|
+
### Chore
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
* Adds Webpack 3.x version range to peerDependencies
|
|
11
11
|
|
|
12
|
-
### 6.0.0
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
<a name="6.0.5"></a>
|
|
14
|
+
# [6.0.5](https://github.com/webpack-contrib/sass-loader/compare/v6.0.5...v6.0.4) (2017-05-10)
|
|
15
15
|
|
|
16
|
-
###
|
|
16
|
+
### Bug Fixes
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
* importing file directly from scoped npm package [#450](https://github.com/webpack-contrib/sass-loader/pull/450) ([5d06e9d](https://github.com/webpack-contrib/sass-loader/commit/5d06e9d))
|
|
19
19
|
|
|
20
|
-
### 5.0.0
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- **Breaking**: Remove node 0.12 support. [29b30755021a834e622bf4b5bb9db4d6e5913905](https://github.com/jtangelder/sass-loader/commit/29b30755021a834e622bf4b5bb9db4d6e5913905)
|
|
21
|
+
<a name="6.0.4"></a>
|
|
22
|
+
# [6.0.4](https://github.com/webpack-contrib/sass-loader/compare/v6.0.4...v6.0.3) (2017-05-09)
|
|
25
23
|
|
|
26
|
-
###
|
|
24
|
+
### Bug Fixes
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
* fix: Resolving of scoped npm packages [#447](https://github.com/webpack-contrib/sass-loader/pull/447)
|
|
29
27
|
|
|
30
|
-
### 4.1.0
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
<a name="6.0.3"></a>
|
|
30
|
+
# [6.0.3](https://github.com/webpack-contrib/sass-loader/compare/v6.0.3...v6.0.2) (2017-03-07)
|
|
33
31
|
|
|
34
|
-
###
|
|
32
|
+
### Bug Fixes
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
* Fix regression with empty files [#398](https://github.com/webpack-contrib/sass-loader/pull/398)
|
|
37
35
|
|
|
38
|
-
### 4.0.1
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
### Chore
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
* Reduce npm package size by using the [files](https://docs.npmjs.com/files/package.json#files) property in the `package.json`
|
|
43
40
|
|
|
44
|
-
- **Breaking**: Release new major version because `3.2.2` was a breaking change in certain scenarios [#250](https://github.com/jtangelder/sass-loader/pull/250) [#254](https://github.com/jtangelder/sass-loader/issues/254)
|
|
45
41
|
|
|
46
|
-
|
|
42
|
+
<a name="6.0.2"></a>
|
|
43
|
+
# [6.0.2](https://github.com/webpack-contrib/sass-loader/compare/v6.0.2...v6.0.1) (2017-02-21)
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
### Chore
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
* Update dependencies [#383](https://github.com/webpack-contrib/sass-loader/pull/383)
|
|
51
48
|
|
|
52
|
-
- Fix incorrect source map paths [#250](https://github.com/jtangelder/sass-loader/pull/250)
|
|
53
49
|
|
|
54
|
-
|
|
50
|
+
<a name="6.0.1"></a>
|
|
51
|
+
# [6.0.1](https://github.com/webpack-contrib/sass-loader/compare/v6.0.1...v6.0.0) (2017-02-17)
|
|
55
52
|
|
|
56
|
-
|
|
53
|
+
### Bug Fixes
|
|
57
54
|
|
|
58
|
-
|
|
55
|
+
* Fix source maps in certain CWDs. [#377](https://github.com/webpack-contrib/sass-loader/pull/377)
|
|
59
56
|
|
|
60
|
-
- Append file content instead of overwriting when `data`-option is already present [#216](https://github.com/jtangelder/sass-loader/pull/216)
|
|
61
|
-
- Make `indentedSyntax` option a bit smarter [#196](https://github.com/jtangelder/sass-loader/pull/196)
|
|
62
57
|
|
|
63
|
-
|
|
58
|
+
<a name="6.0.0"></a>
|
|
59
|
+
# [6.0.0](https://github.com/webpack-contrib/sass-loader/compare/v6.0.0...v5.0.1) (2017-02-13)
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
- Update peer-dependencies [#182](https://github.com/jtangelder/sass-loader/pull/182)
|
|
67
|
-
- `node-sass@^3.4.2`
|
|
68
|
-
- `webpack@^1.12.6`
|
|
61
|
+
### Bug Fixes
|
|
69
62
|
|
|
70
|
-
|
|
63
|
+
* Improve source map support. [#374](https://github.com/webpack-contrib/sass-loader/issues/374)
|
|
71
64
|
|
|
72
|
-
- Fix missing module `object-assign` [#178](https://github.com/jtangelder/sass-loader/issues/178)
|
|
73
65
|
|
|
74
|
-
###
|
|
66
|
+
### BREAKING CHANGES
|
|
75
67
|
|
|
76
|
-
|
|
77
|
-
- Fix a problem where modules with a `.` in their names were not resolved [#167](https://github.com/jtangelder/sass-loader/issues/167)
|
|
68
|
+
* This is breaking for the resolve-url-loader
|
|
78
69
|
|
|
79
|
-
### 3.0.0
|
|
80
70
|
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
<a name="5.0.1"></a>
|
|
72
|
+
# [5.0.1](https://github.com/webpack-contrib/sass-loader/compare/v5.0.1...v5.0.0) (2017-02-13)
|
|
83
73
|
|
|
84
|
-
###
|
|
74
|
+
### Bug Fixes
|
|
85
75
|
|
|
86
|
-
|
|
76
|
+
* Fix bug where multiple compilations interfered with each other. [#369](https://github.com/webpack-contrib/sass-loader/pull/369)
|
|
87
77
|
|
|
88
|
-
### 2.0.0
|
|
89
78
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
- Fix path resolving on Windows [#108](https://github.com/jtangelder/sass-loader/issues/108)
|
|
93
|
-
- Fix file watchers on Windows [#102](https://github.com/jtangelder/sass-loader/issues/102)
|
|
94
|
-
- Fix file watchers for files with errors [#134](https://github.com/jtangelder/sass-loader/pull/134)
|
|
79
|
+
<a name="5.0.0"></a>
|
|
80
|
+
# [5.0.0](https://github.com/webpack-contrib/sass-loader/compare/v5.0.0...v4.1.1) (2017-02-13)
|
|
95
81
|
|
|
96
|
-
###
|
|
82
|
+
### Code Refactoring
|
|
97
83
|
|
|
98
|
-
|
|
99
|
-
- Include source-map contents by default [#104](https://github.com/jtangelder/sass-loader/pull/104)
|
|
84
|
+
* Remove synchronous compilation support [#334](https://github.com/webpack-contrib/sass-loader/pull/334)
|
|
100
85
|
|
|
101
|
-
### 1.0.3
|
|
102
86
|
|
|
103
|
-
|
|
104
|
-
- Fix importing Sass partials from includePath [#98](https://github.com/jtangelder/sass-loader/issues/98) [#110](https://github.com/jtangelder/sass-loader/issues/110)
|
|
87
|
+
### BREAKING CHANGES
|
|
105
88
|
|
|
106
|
-
|
|
89
|
+
* Remove node 0.12 support. [29b30755021a834e622bf4b5bb9db4d6e5913905](https://github.com/webpack-contrib/sass-loader/commit/29b30755021a834e622bf4b5bb9db4d6e5913905)
|
|
90
|
+
* Remove official node-sass@3 and webpack@1 support. [5a6bcb96d8bd7a7a11c33252ba739ffe09ca38c5](https://github.com/webpack-contrib/sass-loader/commit/5a6bcb96d8bd7a7a11c33252ba739ffe09ca38c5)
|
|
91
|
+
* Remove synchronous compilation support. [#334](https://github.com/webpack-contrib/sass-loader/pull/334)
|
|
107
92
|
|
|
108
|
-
- Fix a bug where files could not be imported across language styles [#73](https://github.com/jtangelder/sass-loader/issues/73)
|
|
109
|
-
- Update peer-dependency `node-sass` to `3.1.0`
|
|
110
93
|
|
|
111
|
-
|
|
94
|
+
<a name="4.1.1"></a>
|
|
95
|
+
# [4.1.1](https://github.com/webpack-contrib/sass-loader/compare/v4.1.1...v4.1.0) (2016-12-21)
|
|
112
96
|
|
|
113
|
-
|
|
114
|
-
- Update peer-dependency `node-sass` to `3.0.0-beta.4`
|
|
97
|
+
### Chore
|
|
115
98
|
|
|
116
|
-
|
|
99
|
+
* Update webpack peer dependency to support 2.2.0rc. [#330](https://github.com/webpack-contrib/sass-loader/pull/330)
|
|
117
100
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
101
|
+
|
|
102
|
+
<a name="4.1.0"></a>
|
|
103
|
+
# [4.1.0](https://github.com/webpack-contrib/sass-loader/compare/v4.1.0...v4.0.2) (2016-12-14)
|
|
104
|
+
|
|
105
|
+
### Features
|
|
106
|
+
|
|
107
|
+
* Update `node-sass@4.0.0` [#319](https://github.com/webpack-contrib/sass-loader/pull/319)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<a name="4.0.2"></a>
|
|
111
|
+
# [4.0.2](https://github.com/webpack-contrib/sass-loader/compare/v4.0.2...v4.0.1) (2016-07-07)
|
|
112
|
+
|
|
113
|
+
### Bug Fixes
|
|
114
|
+
|
|
115
|
+
* Fix wrong context in customImporters [#281](https://github.com/webpack-contrib/sass-loader/pull/281)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
<a name="4.0.1"></a>
|
|
119
|
+
# [4.0.1](https://github.com/webpack-contrib/sass-loader/compare/v4.0.1...v4.0.0) (2016-07-01)
|
|
120
|
+
|
|
121
|
+
### Bug Fixes
|
|
122
|
+
|
|
123
|
+
* Fix custom importers receiving `'stdin'` as second argument instead of the actual `resourcePath` [#267](https://github.com/webpack-contrib/sass-loader/pull/267)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
<a name="4.0.0"></a>
|
|
127
|
+
# [4.0.0](https://github.com/webpack-contrib/sass-loader/compare/v4.0.0...v3.2.2) (2016-06-27)
|
|
128
|
+
|
|
129
|
+
### Bug Fixes
|
|
130
|
+
|
|
131
|
+
* Fix incorrect source map paths [#250](https://github.com/webpack-contrib/sass-loader/pull/250)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### BREAKING CHANGES
|
|
135
|
+
|
|
136
|
+
* Release new major version because the previous release was a breaking change in certain scenarios
|
|
137
|
+
See: https://github.com/webpack-contrib/sass-loader/pull/250#issuecomment-228663059
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
<a name="3.2.2"></a>
|
|
141
|
+
# [3.2.2](https://github.com/webpack-contrib/sass-loader/compare/v3.2.2...v3.2.1) (2016-06-26)
|
|
142
|
+
|
|
143
|
+
### Bug Fixes
|
|
144
|
+
|
|
145
|
+
* Fix incorrect source map paths [#250](https://github.com/webpack-contrib/sass-loader/pull/250)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
<a name="3.2.1"></a>
|
|
149
|
+
# [3.2.1](https://github.com/webpack-contrib/sass-loader/compare/v3.2.1...v3.2.0) (2016-06-19)
|
|
150
|
+
|
|
151
|
+
### Bug Fixes
|
|
152
|
+
|
|
153
|
+
* Add `webpack@^2.1.0-beta` as peer dependency [#233](https://github.com/webpack-contrib/sass-loader/pull/233)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
<a name="3.2.0"></a>
|
|
157
|
+
# [3.2.0](https://github.com/webpack-contrib/sass-loader/compare/v3.2.0...v3.1.2) (2016-03-12)
|
|
158
|
+
|
|
159
|
+
### Features
|
|
160
|
+
|
|
161
|
+
* Append file content instead of overwriting when `data`-option is already present [#216](https://github.com/webpack-contrib/sass-loader/pull/216)
|
|
162
|
+
* Make `indentedSyntax` option a bit smarter [#196](https://github.com/webpack-contrib/sass-loader/pull/196)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
<a name="3.1.2"></a>
|
|
166
|
+
# [3.1.2](https://github.com/webpack-contrib/sass-loader/compare/v3.1.2...v3.1.1) (2015-11-22)
|
|
167
|
+
|
|
168
|
+
### Bug Fixes
|
|
169
|
+
|
|
170
|
+
* Fix loader query not overriding webpack config [#189](https://github.com/webpack-contrib/sass-loader/pull/189)
|
|
171
|
+
* Update peer-dependencies [#182](https://github.com/webpack-contrib/sass-loader/pull/182)
|
|
172
|
+
- `node-sass^3.4.2`
|
|
173
|
+
- `webpack^1.12.6`
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<a name="3.1.1"></a>
|
|
177
|
+
# [3.1.1](https://github.com/webpack-contrib/sass-loader/compare/v3.1.1...v3.1.0) (2015-10-26)
|
|
178
|
+
|
|
179
|
+
### Bug Fixes
|
|
180
|
+
|
|
181
|
+
* Fix missing module `object-assign` [#178](https://github.com/webpack-contrib/sass-loader/issues/178)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
<a name="3.1.0"></a>
|
|
185
|
+
# [3.1.0](https://github.com/webpack-contrib/sass-loader/compare/v3.1.0...v3.0.0) (2015-10-25)
|
|
186
|
+
|
|
187
|
+
### Bug Fixes
|
|
188
|
+
|
|
189
|
+
* Fix a problem where modules with a `.` in their names were not resolved [#167](https://github.com/webpack-contrib/sass-loader/issues/167)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### Features
|
|
193
|
+
|
|
194
|
+
* Add possibility to also define all options in your `webpack.config.js` [#152](https://github.com/webpack-contrib/sass-loader/pull/152) [#170](https://github.com/webpack-contrib/sass-loader/pull/170)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
<a name="3.0.0"></a>
|
|
198
|
+
# [3.0.0](https://github.com/webpack-contrib/sass-loader/compare/v3.0.0...v2.0.1) (2015-09-29)
|
|
199
|
+
|
|
200
|
+
### Bug Fixes
|
|
201
|
+
|
|
202
|
+
* Fix crash when Sass reported an error without `file` [#158](https://github.com/webpack-contrib/sass-loader/pull/158)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
### BREAKING CHANGES
|
|
206
|
+
|
|
207
|
+
* Add `node-sass@^3.3.3` and `webpack@^1.12.2` as peer-dependency [#165](https://github.com/webpack-contrib/sass-loader/pull/165) [#166](https://github.com/webpack-contrib/sass-loader/pull/166) [#169](https://github.com/webpack-contrib/sass-loader/pull/169)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
<a name="2.0.1"></a>
|
|
211
|
+
# [2.0.1](https://github.com/webpack-contrib/sass-loader/compare/v2.0.1...v2.0.0) (2015-08-14)
|
|
212
|
+
|
|
213
|
+
### Bug Fixes
|
|
214
|
+
|
|
215
|
+
* Add missing path normalization (fixes [#141](https://github.com/webpack-contrib/sass-loader/pull/141))
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
<a name="2.0.0"></a>
|
|
219
|
+
# [2.0.0](https://github.com/webpack-contrib/sass-loader/compare/v2.0.0...v1.0.4) (2015-08-06)
|
|
220
|
+
|
|
221
|
+
### Bug Fixes
|
|
222
|
+
|
|
223
|
+
* Add temporary fix for stuck processes (see [sass/node-sass#857](https://github.com/sass/node-sass/issues/857)) [#100](https://github.com/webpack-contrib/sass-loader/issues/100) [#119](https://github.com/webpack-contrib/sass-loader/issues/119) [#132](https://github.com/webpack-contrib/sass-loader/pull/132)
|
|
224
|
+
* Fix path resolving on Windows [#108](https://github.com/webpack-contrib/sass-loader/issues/108)
|
|
225
|
+
* Fix file watchers on Windows [#102](https://github.com/webpack-contrib/sass-loader/issues/102)
|
|
226
|
+
* Fix file watchers for files with errors [#134](https://github.com/webpack-contrib/sass-loader/pull/134)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
### Code Refactoring
|
|
230
|
+
|
|
231
|
+
* Refactor [import resolving algorithm](https://github.com/webpack-contrib/sass-loader/blob/089c52dc9bd02ec67fb5c65c2c226f43710f231c/index.js#L293-L348). ([#138](https://github.com/webpack-contrib/sass-loader/issues/138)) ([c8621a1](https://github.com/webpack-contrib/sass-loader/commit/80944ccf09cd9716a100160c068d255c5d742338))
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
### BREAKING CHANGES
|
|
235
|
+
|
|
236
|
+
* The new algorithm is aligned to libsass' way of resolving files. This yields to different results if two files with the same path and filename but with different extensions are present. Though this change should be no problem for most users, we must flag it as breaking change. [#135](https://github.com/webpack-contrib/sass-loader/issues/135) [#138](https://github.com/webpack-contrib/sass-loader/issues/138)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
<a name="1.0.4"></a>
|
|
240
|
+
# [1.0.4](https://github.com/webpack-contrib/sass-loader/compare/v1.0.4...v1.0.3) (2015-08-03)
|
|
241
|
+
|
|
242
|
+
### Bug Fixes
|
|
243
|
+
|
|
244
|
+
* Fix wrong source-map urls [#123](https://github.com/webpack-contrib/sass-loader/pull/123)
|
|
245
|
+
* Include source-map contents by default [#104](https://github.com/webpack-contrib/sass-loader/pull/104)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
<a name="1.0.3"></a>
|
|
249
|
+
# [1.0.3](https://github.com/webpack-contrib/sass-loader/compare/v1.0.3...v1.0.2) (2015-07-22)
|
|
250
|
+
|
|
251
|
+
### Bug Fixes
|
|
252
|
+
|
|
253
|
+
* Fix importing css files from scss/sass [#101](https://github.com/webpack-contrib/sass-loader/issues/101)
|
|
254
|
+
* Fix importing Sass partials from includePath [#98](https://github.com/webpack-contrib/sass-loader/issues/98) [#110](https://github.com/webpack-contrib/sass-loader/issues/110)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
<a name="1.0.2"></a>
|
|
258
|
+
# [1.0.2](https://github.com/webpack-contrib/sass-loader/compare/v1.0.2...v1.0.1) (2015-04-15)
|
|
259
|
+
|
|
260
|
+
### Bug Fixes
|
|
261
|
+
|
|
262
|
+
* Fix a bug where files could not be imported across language styles [#73](https://github.com/webpack-contrib/sass-loader/issues/73)
|
|
263
|
+
* Update peer-dependency `node-sass` to `3.1.0`
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
<a name="1.0.1"></a>
|
|
267
|
+
# [1.0.1](https://github.com/webpack-contrib/sass-loader/compare/v1.0.1...v1.0.0) (2015-03-31)
|
|
268
|
+
|
|
269
|
+
### Bug Fixes
|
|
270
|
+
|
|
271
|
+
* Fix Sass partials not being resolved anymore [#68](https://github.com/webpack-contrib/sass-loader/issues/68)
|
|
272
|
+
* Update peer-dependency `node-sass` to `3.0.0-beta.4`
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
<a name="1.0.0"></a>
|
|
276
|
+
# [1.0.0](https://github.com/webpack-contrib/sass-loader/compare/v1.0.0...v0.3.1) (2015-03-22)
|
|
277
|
+
|
|
278
|
+
### Bug Fixes
|
|
279
|
+
|
|
280
|
+
* Moved `node-sass^3.0.0-alpha.0` to `peerDependencies` [#28](https://github.com/webpack-contrib/sass-loader/issues/28)
|
|
281
|
+
* Using webpack's module resolver as custom importer [#39](https://github.com/webpack-contrib/sass-loader/issues/31)
|
|
282
|
+
* Add synchronous compilation support for usage with [enhanced-require](https://github.com/webpack/enhanced-require) [#39](https://github.com/webpack-contrib/sass-loader/pull/39)
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
[![npm][npm]][npm-url]
|
|
2
|
+
[![node][node]][node-url]
|
|
3
|
+
[![npm-stats][npm-stats]][npm-url]
|
|
2
4
|
[![deps][deps]][deps-url]
|
|
3
|
-
[![
|
|
5
|
+
[![travis][travis]][travis-url]
|
|
6
|
+
[![appveyor][appveyor]][appveyor-url]
|
|
7
|
+
[![coverage][cover]][cover-url]
|
|
8
|
+
[![chat][chat]][chat-url]
|
|
4
9
|
|
|
5
10
|
<div align="center">
|
|
6
11
|
<img height="100"
|
|
7
12
|
src="https://worldvectorlogo.com/logos/sass-1.svg">
|
|
8
13
|
<a href="https://github.com/webpack/webpack">
|
|
9
|
-
<img height="
|
|
10
|
-
src="https://
|
|
14
|
+
<img width="200" height="200"
|
|
15
|
+
src="https://webpack.js.org/assets/icon-square-big.svg">
|
|
11
16
|
</a>
|
|
12
|
-
<h1>
|
|
13
|
-
<p>
|
|
14
|
-
<p>Looking for the webpack 1 loader? Check out the <a href="https://github.com/jtangelder/sass-loader/tree/archive/webpack-1">archive/webpack-1 branch</a>.</p>
|
|
17
|
+
<h1>SASS Loader</h1>
|
|
18
|
+
<p>Loads a SASS/SCSS file and compiles it to CSS.</p>
|
|
15
19
|
</div>
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
Use the [css-loader](https://github.com/webpack-contrib/css-loader) or the [raw-loader](https://github.com/webpack-contrib/raw-loader) to turn it into a JS module and the [ExtractTextPlugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) to extract it into a separate file.
|
|
22
|
+
Looking for the webpack 1 loader? Check out the [archive/webpack-1 branch](https://github.com/webpack-contrib/sass-loader/tree/archive/webpack-1).
|
|
23
|
+
|
|
24
|
+
<h2 align="center">Install</h2>
|
|
18
25
|
|
|
19
26
|
```bash
|
|
20
27
|
npm install sass-loader node-sass webpack --save-dev
|
|
21
28
|
```
|
|
22
29
|
|
|
23
|
-
The sass-loader requires [node-sass](https://github.com/sass/node-sass) and [webpack](https://github.com/webpack
|
|
30
|
+
The sass-loader requires [node-sass](https://github.com/sass/node-sass) and [webpack](https://github.com/webpack)
|
|
24
31
|
as [`peerDependency`](https://docs.npmjs.com/files/package.json#peerdependencies). Thus you are able to control the versions accurately.
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
<h2 align="center">Examples</h2>
|
|
27
34
|
|
|
28
|
-
Chain the sass-loader with the [css-loader](https://github.com/webpack/css-loader) and the [style-loader](https://github.com/webpack/style-loader) to immediately apply all styles to the DOM.
|
|
35
|
+
Chain the sass-loader with the [css-loader](https://github.com/webpack-contrib/css-loader) and the [style-loader](https://github.com/webpack-contrib/style-loader) to immediately apply all styles to the DOM.
|
|
29
36
|
|
|
30
37
|
```js
|
|
31
38
|
// webpack.config.js
|
|
@@ -74,7 +81,7 @@ See [node-sass](https://github.com/andrew/node-sass) for all available Sass opti
|
|
|
74
81
|
|
|
75
82
|
### In production
|
|
76
83
|
|
|
77
|
-
Usually, it's recommended to extract the
|
|
84
|
+
Usually, it's recommended to extract the style sheets into a dedicated file in production using the [ExtractTextPlugin](https://github.com/webpack-contrib/extract-text-webpack-plugin). This way your styles are not dependent on JavaScript:
|
|
78
85
|
|
|
79
86
|
```js
|
|
80
87
|
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
@@ -89,14 +96,14 @@ module.exports = {
|
|
|
89
96
|
module: {
|
|
90
97
|
rules: [{
|
|
91
98
|
test: /\.scss$/,
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
use: extractSass.extract({
|
|
100
|
+
use: [{
|
|
94
101
|
loader: "css-loader"
|
|
95
102
|
}, {
|
|
96
103
|
loader: "sass-loader"
|
|
97
104
|
}],
|
|
98
105
|
// use style-loader in development
|
|
99
|
-
|
|
106
|
+
fallback: "style-loader"
|
|
100
107
|
})
|
|
101
108
|
}]
|
|
102
109
|
},
|
|
@@ -106,32 +113,18 @@ module.exports = {
|
|
|
106
113
|
};
|
|
107
114
|
```
|
|
108
115
|
|
|
109
|
-
|
|
116
|
+
<h2 align="center">Usage</h2>
|
|
110
117
|
|
|
111
118
|
### Imports
|
|
112
119
|
|
|
113
|
-
webpack provides an [advanced mechanism to resolve files](
|
|
120
|
+
webpack provides an [advanced mechanism to resolve files](https://webpack.js.org/concepts/module-resolution/). The sass-loader uses node-sass' custom importer feature to pass all queries to the webpack resolving engine. Thus you can import your Sass modules from `node_modules`. Just prepend them with a `~` to tell webpack that this is not a relative import:
|
|
114
121
|
|
|
115
122
|
```css
|
|
116
|
-
@import "~bootstrap/css/bootstrap";
|
|
123
|
+
@import "~bootstrap/dist/css/bootstrap";
|
|
117
124
|
```
|
|
118
125
|
|
|
119
126
|
It's important to only prepend it with `~`, because `~/` resolves to the home directory. webpack needs to distinguish between `bootstrap` and `~bootstrap` because CSS and Sass files have no special syntax for importing relative files. Writing `@import "file"` is the same as `@import "./file";`
|
|
120
127
|
|
|
121
|
-
### Environment variables
|
|
122
|
-
|
|
123
|
-
If you want to prepend Sass code before the actual entry file, you can simply set the `data` option. In this case, the sass-loader will not override the `data` option but just append the entry's content. This is especially useful when some of your Sass variables depend on the environment:
|
|
124
|
-
|
|
125
|
-
```javascript
|
|
126
|
-
{
|
|
127
|
-
loader: "sass-loader",
|
|
128
|
-
options: {
|
|
129
|
-
data: "$env: " + process.env.NODE_ENV + ";"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
|
|
135
128
|
### Problems with `url(...)`
|
|
136
129
|
|
|
137
130
|
Since Sass/[libsass](https://github.com/sass/libsass) does not provide [url rewriting](https://github.com/sass/libsass/issues/532), all linked assets must be relative to the output.
|
|
@@ -142,16 +135,16 @@ Since Sass/[libsass](https://github.com/sass/libsass) does not provide [url rewr
|
|
|
142
135
|
More likely you will be disrupted by this second issue. It is natural to expect relative references to be resolved against the `.scss` file in which they are specified (like in regular `.css` files). Thankfully there are a two solutions to this problem:
|
|
143
136
|
|
|
144
137
|
- Add the missing url rewriting using the [resolve-url-loader](https://github.com/bholloway/resolve-url-loader). Place it directly after the sass-loader in the loader chain.
|
|
145
|
-
- Library authors usually provide a variable to modify the asset path. [bootstrap-sass](https://github.com/twbs/bootstrap-sass) for example has an `$icon-font-path`. Check out [this working bootstrap example](https://github.com/
|
|
138
|
+
- Library authors usually provide a variable to modify the asset path. [bootstrap-sass](https://github.com/twbs/bootstrap-sass) for example has an `$icon-font-path`. Check out [this working bootstrap example](https://github.com/webpack-contrib/sass-loader/tree/master/test/bootstrapSass).
|
|
146
139
|
|
|
147
|
-
### Extracting
|
|
140
|
+
### Extracting style sheets
|
|
148
141
|
|
|
149
|
-
Bundling CSS with webpack has some nice advantages like referencing images and fonts with hashed urls or [hot module replacement](
|
|
142
|
+
Bundling CSS with webpack has some nice advantages like referencing images and fonts with hashed urls or [hot module replacement](https://webpack.js.org/concepts/hot-module-replacement/) in development. In production, on the other hand, it's not a good idea to apply your style sheets depending on JS execution. Rendering may be delayed or even a [FOUC](https://en.wikipedia.org/wiki/Flash_of_unstyled_content) might be visible. Thus it's often still better to have them as separate files in your final production build.
|
|
150
143
|
|
|
151
|
-
There are two
|
|
144
|
+
There are two possibilities to extract a style sheet from the bundle:
|
|
152
145
|
|
|
153
146
|
- [extract-loader](https://github.com/peerigon/extract-loader) (simpler, but specialized on the css-loader's output)
|
|
154
|
-
- [extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin) (more complex, but works in all use-cases)
|
|
147
|
+
- [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) (more complex, but works in all use-cases)
|
|
155
148
|
|
|
156
149
|
### Source maps
|
|
157
150
|
|
|
@@ -180,44 +173,65 @@ module.exports = {
|
|
|
180
173
|
};
|
|
181
174
|
```
|
|
182
175
|
|
|
183
|
-
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/
|
|
176
|
+
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/webpack-contrib/sass-loader/tree/master/test) for a running example.
|
|
184
177
|
|
|
178
|
+
### Environment variables
|
|
185
179
|
|
|
186
|
-
|
|
180
|
+
If you want to prepend Sass code before the actual entry file, you can set the `data` option. In this case, the sass-loader will not override the `data` option but just append the entry's content. This is especially useful when some of your Sass variables depend on the environment:
|
|
181
|
+
|
|
182
|
+
```javascript
|
|
183
|
+
{
|
|
184
|
+
loader: "sass-loader",
|
|
185
|
+
options: {
|
|
186
|
+
data: "$env: " + process.env.NODE_ENV + ";"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Please note:** Since you're injecting code, this will break the source mappings in your entry file. Often there's a simpler solution than this, like multiple Sass entry files.
|
|
192
|
+
|
|
193
|
+
<h2 align="center">Maintainers</h2>
|
|
187
194
|
|
|
188
195
|
<table>
|
|
189
|
-
<tbody>
|
|
190
196
|
<tr>
|
|
191
197
|
<td align="center">
|
|
192
|
-
<img width="150 height="150"
|
|
193
|
-
src="https://avatars0.githubusercontent.com/u/781746?v=3"><br>
|
|
198
|
+
<a href="https://github.com/jhnns"><img width="150" height="150" src="https://avatars0.githubusercontent.com/u/781746?v=3"></a><br>
|
|
194
199
|
<a href="https://github.com/jhnns">Johannes Ewald</a>
|
|
195
200
|
</td>
|
|
196
201
|
<td align="center">
|
|
197
|
-
<img width="150 height="150"
|
|
198
|
-
|
|
199
|
-
<a href="https://github.com/jtangelder">Jorik Tangelder</a>
|
|
202
|
+
<a href="https://github.com/webpack-contrib"><img width="150" height="150" src="https://avatars1.githubusercontent.com/u/1243901?v=3&s=460"></a><br>
|
|
203
|
+
<a href="https://github.com/webpack-contrib">Jorik Tangelder</a>
|
|
200
204
|
</td>
|
|
201
205
|
<td align="center">
|
|
202
|
-
<img width="150" height="150"
|
|
203
|
-
src="https://avatars1.githubusercontent.com/u/3403295?v=3"><br>
|
|
206
|
+
<a href="https://github.com/akiran"><img width="150" height="150" src="https://avatars1.githubusercontent.com/u/3403295?v=3"></a><br>
|
|
204
207
|
<a href="https://github.com/akiran">Kiran</a>
|
|
205
208
|
</td>
|
|
206
209
|
<tr>
|
|
207
|
-
<tbody>
|
|
208
210
|
</table>
|
|
209
211
|
|
|
210
212
|
|
|
211
|
-
|
|
213
|
+
<h2 align="center">License</h2>
|
|
212
214
|
|
|
213
215
|
[MIT](http://www.opensource.org/licenses/mit-license.php)
|
|
214
216
|
|
|
215
|
-
|
|
216
217
|
[npm]: https://img.shields.io/npm/v/sass-loader.svg
|
|
218
|
+
[npm-stats]: https://img.shields.io/npm/dm/sass-loader.svg
|
|
217
219
|
[npm-url]: https://npmjs.com/package/sass-loader
|
|
218
220
|
|
|
219
|
-
[
|
|
220
|
-
[
|
|
221
|
+
[node]: https://img.shields.io/node/v/sass-loader.svg
|
|
222
|
+
[node-url]: https://nodejs.org
|
|
223
|
+
|
|
224
|
+
[deps]: https://david-dm.org/webpack-contrib/sass-loader.svg
|
|
225
|
+
[deps-url]: https://david-dm.org/webpack-contrib/sass-loader
|
|
226
|
+
|
|
227
|
+
[travis]: http://img.shields.io/travis/webpack-contrib/sass-loader.svg
|
|
228
|
+
[travis-url]: https://travis-ci.org/webpack-contrib/sass-loader
|
|
229
|
+
|
|
230
|
+
[appveyor-url]: https://ci.appveyor.com/project/webpack-contrib/sass-loader/branch/master
|
|
231
|
+
[appveyor]: https://ci.appveyor.com/api/projects/status/rqpy1vaovh20ttxs/branch/master?svg=true
|
|
232
|
+
|
|
233
|
+
[cover]: https://codecov.io/gh/webpack-contrib/sass-loader/branch/master/graph/badge.svg
|
|
234
|
+
[cover-url]: https://codecov.io/gh/webpack-contrib/sass-loader
|
|
221
235
|
|
|
222
|
-
[
|
|
223
|
-
[
|
|
236
|
+
[chat]: https://badges.gitter.im/webpack/webpack.svg
|
|
237
|
+
[chat-url]: https://gitter.im/webpack/webpack
|
package/lib/importsToResolve.js
CHANGED
|
@@ -23,17 +23,26 @@ function importsToResolve(request) {
|
|
|
23
23
|
// - The exact file name must match (no auto-resolving of '_'-modules).
|
|
24
24
|
|
|
25
25
|
// Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot.
|
|
26
|
-
// @see https://github.com/
|
|
26
|
+
// @see https://github.com/webpack-contrib/sass-loader/issues/167
|
|
27
27
|
const ext = path.extname(request);
|
|
28
28
|
const basename = path.basename(request);
|
|
29
29
|
const dirname = path.dirname(request);
|
|
30
30
|
const startsWithUnderscore = basename.charAt(0) === "_";
|
|
31
|
-
// a module import is an identifier like 'bootstrap-sass'
|
|
32
|
-
// We also need to check for dirname since it might also be a deep import like 'bootstrap-sass/something'
|
|
33
|
-
const isModuleImport = request.charAt(0) !== "." && dirname === ".";
|
|
34
31
|
const hasCssExt = ext === ".css";
|
|
35
32
|
const hasSassExt = ext === ".scss" || ext === ".sass";
|
|
36
33
|
|
|
34
|
+
// a module import is an identifier like 'bootstrap-sass'
|
|
35
|
+
// We also need to check for dirname since it might also be a deep import like 'bootstrap-sass/something'
|
|
36
|
+
let isModuleImport = request.charAt(0) !== "." && dirname === ".";
|
|
37
|
+
|
|
38
|
+
if (dirname.charAt(0) === "@") {
|
|
39
|
+
// Check whether it is a deep import from scoped npm package
|
|
40
|
+
// (i.e. @pkg/foo/file), if so, process import as file import;
|
|
41
|
+
// otherwise, if we import from root npm scoped package (i.e. @pkg/foo)
|
|
42
|
+
// process import as a module import.
|
|
43
|
+
isModuleImport = !(dirname.indexOf("/") > -1);
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
return (isModuleImport && [request]) || // Do not modify module imports
|
|
38
47
|
(hasCssExt && []) || // Do not import css files
|
|
39
48
|
(hasSassExt && [request]) || // Do not modify imports with explicit extensions
|
package/lib/loader.js
CHANGED
|
@@ -32,17 +32,21 @@ function sassLoader(content) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (isSync) {
|
|
35
|
-
throw new Error("Synchronous compilation is not supported anymore. See https://github.com/
|
|
35
|
+
throw new Error("Synchronous compilation is not supported anymore. See https://github.com/webpack-contrib/sass-loader/issues/333");
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
this.cacheable();
|
|
39
|
-
|
|
40
38
|
const options = normalizeOptions(this, content, webpackImporter(
|
|
41
39
|
resourcePath,
|
|
42
40
|
pify(this.resolve.bind(this)),
|
|
43
41
|
addNormalizedDependency
|
|
44
42
|
));
|
|
45
43
|
|
|
44
|
+
// Skip empty files, otherwise it will stop webpack, see issue #21
|
|
45
|
+
if (options.data.trim() === "") {
|
|
46
|
+
callback(null, "");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
// start the actual rendering
|
|
47
51
|
asyncSassJobQueue.push(options, (err, result) => {
|
|
48
52
|
if (err) {
|
|
@@ -64,7 +68,7 @@ function sassLoader(content) {
|
|
|
64
68
|
result.map.sources[0] = path.relative(process.cwd(), resourcePath);
|
|
65
69
|
// node-sass returns POSIX paths, that's why we need to transform them back to native paths.
|
|
66
70
|
// This fixes an error on windows where the source-map module cannot resolve the source maps.
|
|
67
|
-
// @see https://github.com/
|
|
71
|
+
// @see https://github.com/webpack-contrib/sass-loader/issues/366#issuecomment-279460722
|
|
68
72
|
result.map.sourceRoot = path.normalize(result.map.sourceRoot);
|
|
69
73
|
result.map.sources = result.map.sources.map(path.normalize);
|
|
70
74
|
} else {
|
package/package.json
CHANGED
|
@@ -1,56 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sass-loader",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.6",
|
|
4
4
|
"description": "Sass loader for webpack",
|
|
5
|
+
"author": "J. Tangelder",
|
|
6
|
+
"license": "MIT",
|
|
5
7
|
"main": "lib/loader.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"lib"
|
|
10
|
+
],
|
|
6
11
|
"scripts": {
|
|
12
|
+
"appveyor:test": "npm test",
|
|
7
13
|
"create-spec": "node test/tools/runCreateSpec.js",
|
|
8
|
-
"
|
|
9
|
-
"test": "mocha -R spec -t 10000",
|
|
10
|
-
"posttest": "eslint --fix lib test",
|
|
14
|
+
"lint": "eslint lib test",
|
|
15
|
+
"test": "nyc --all mocha -R spec -t 10000",
|
|
11
16
|
"test-bootstrap-sass": "webpack-dev-server --config test/bootstrapSass/webpack.config.js --content-base ./test/bootstrapSass",
|
|
12
17
|
"test-source-map": "webpack-dev-server --config test/sourceMap/webpack.config.js --content-base ./test/sourceMap --inline",
|
|
13
18
|
"test-watch": "webpack --config test/watch/webpack.config.js",
|
|
14
19
|
"test-extract-text": "webpack --config test/extractText/webpack.config.js",
|
|
15
|
-
"test-hmr": "webpack-dev-server --config test/hmr/webpack.config.js --content-base ./test/hmr --hot --inline"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
],
|
|
23
|
-
"repository": {
|
|
24
|
-
"type": "git",
|
|
25
|
-
"url": "git://github.com/jtangelder/sass-loader.git"
|
|
26
|
-
},
|
|
27
|
-
"author": "J. Tangelder",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"peerDependencies": {
|
|
30
|
-
"node-sass": "^4.0.0",
|
|
31
|
-
"webpack": "^2.0.0"
|
|
20
|
+
"test-hmr": "webpack-dev-server --config test/hmr/webpack.config.js --content-base ./test/hmr --hot --inline",
|
|
21
|
+
"travis:lint": "npm run lint",
|
|
22
|
+
"travis:test": "npm run test",
|
|
23
|
+
"travis:coverage": "npm run test",
|
|
24
|
+
"pretest": "npm run create-spec",
|
|
25
|
+
"posttest": "npm run lint",
|
|
26
|
+
"release": "standard-version"
|
|
32
27
|
},
|
|
33
28
|
"dependencies": {
|
|
34
29
|
"async": "^2.1.5",
|
|
35
|
-
"clone-deep": "^0.
|
|
30
|
+
"clone-deep": "^0.3.0",
|
|
36
31
|
"loader-utils": "^1.0.1",
|
|
37
32
|
"lodash.tail": "^4.1.1",
|
|
38
|
-
"pify": "^
|
|
33
|
+
"pify": "^3.0.0"
|
|
39
34
|
},
|
|
40
35
|
"devDependencies": {
|
|
41
36
|
"bootstrap-sass": "^3.3.5",
|
|
42
|
-
"css-loader": "^0.
|
|
37
|
+
"css-loader": "^0.28.4",
|
|
43
38
|
"eslint": "^3.16.0",
|
|
44
39
|
"eslint-config-peerigon": "^9.0.0",
|
|
45
40
|
"eslint-plugin-jsdoc": "^2.4.0",
|
|
46
|
-
"file-loader": "^0.
|
|
41
|
+
"file-loader": "^0.11.2",
|
|
47
42
|
"mocha": "^3.0.2",
|
|
48
43
|
"node-sass": "^4.5.0",
|
|
44
|
+
"nyc": "^11.0.2",
|
|
49
45
|
"raw-loader": "^0.5.1",
|
|
50
46
|
"should": "^11.2.0",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
47
|
+
"standard-version": "^4.2.0",
|
|
48
|
+
"style-loader": "^0.18.2",
|
|
53
49
|
"webpack-dev-server": "^2.4.1",
|
|
54
|
-
"webpack-merge": "^
|
|
55
|
-
}
|
|
50
|
+
"webpack-merge": "^4.0.0"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">= 4.3 < 5.0.0 || >= 5.10"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"node-sass": "^4.0.0",
|
|
57
|
+
"webpack": "^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0"
|
|
58
|
+
},
|
|
59
|
+
"keywords": [
|
|
60
|
+
"sass",
|
|
61
|
+
"libsass",
|
|
62
|
+
"webpack",
|
|
63
|
+
"loader"
|
|
64
|
+
],
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "git://github.com/webpack-contrib/sass-loader.git"
|
|
68
|
+
},
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/webpack-contrib/sass-loader/issues"
|
|
71
|
+
},
|
|
72
|
+
"homepage": "https://github.com/webpack-contrib/sass-loader"
|
|
56
73
|
}
|
package/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# This file is for unifying the coding style for different editors and IDEs.
|
|
2
|
-
# More information at http://EditorConfig.org
|
|
3
|
-
|
|
4
|
-
# No .editorconfig files above the root directory
|
|
5
|
-
root = true
|
|
6
|
-
|
|
7
|
-
[*]
|
|
8
|
-
indent_style = space
|
|
9
|
-
indent_size = 4
|
|
10
|
-
charset = utf-8
|
|
11
|
-
trim_trailing_whitespace = true
|
|
12
|
-
insert_final_newline = true
|
|
13
|
-
|
|
14
|
-
[package.json]
|
|
15
|
-
indent_size = 2
|
package/.eslintignore
DELETED
package/.eslintrc.json
DELETED
package/.npmignore
DELETED