sass-loader 6.0.5 → 7.0.1
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 +269 -77
- package/README.md +11 -7
- package/lib/formatSassError.js +1 -1
- package/lib/importsToResolve.js +38 -36
- package/lib/loader.js +24 -5
- package/lib/webpackImporter.js +1 -2
- package/package.json +40 -38
package/CHANGELOG.md
CHANGED
|
@@ -1,133 +1,325 @@
|
|
|
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="7.0.1"></a>
|
|
6
|
+
## [7.0.1](https://github.com/webpack-contrib/sass-loader/compare/v7.0.0...v7.0.1) (2018-04-13)
|
|
7
7
|
|
|
8
|
-
### 6.0.4
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
### Bug Fixes
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
* Wrong import precedence (#557) ([f4eeff1](https://github.com/webpack-contrib/sass-loader/commit/f4eeff1))
|
|
13
12
|
|
|
14
|
-
- Fix regression with empty files [#398](https://github.com/webpack-contrib/sass-loader/pull/398)
|
|
15
|
-
- Reduce npm package size by using the [files](https://docs.npmjs.com/files/package.json#files) property in the `package.json`
|
|
16
13
|
|
|
17
|
-
### 6.0.2
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
<a name="7.0.0"></a>
|
|
16
|
+
# [7.0.0](https://github.com/webpack-contrib/sass-loader/compare/v6.0.7...v7.0.0) (2018-04-13)
|
|
20
17
|
|
|
21
|
-
### 6.0.1
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
### Features
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
* Refactor resolving and simplify webpack config aliases (#479) ([e0fde1a](https://github.com/webpack-contrib/sass-loader/commit/e0fde1a))
|
|
22
|
+
* Remove `node-sass` from `peerDependencies` (#533) ([6439cef](https://github.com/webpack-contrib/sass-loader/commit/6439cef))
|
|
26
23
|
|
|
27
|
-
- **Breaking** (for resolve-url-loader only): Improve source map support. [#374](https://github.com/webpack-contrib/sass-loader/issues/374)
|
|
28
24
|
|
|
29
|
-
###
|
|
25
|
+
### BREAKING CHANGES
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
* Drop official node 4 support
|
|
28
|
+
* This slightly changes the resolving algorithm. Should not break in normal usage, but might break in complex configurations.
|
|
29
|
+
* The sass-loader throws an error at runtime now and refuses to compile if the peer dependency is wrong. This could break applications where npm's peer dependency warning was just ignored.
|
|
32
30
|
|
|
33
|
-
### 5.0.0
|
|
34
31
|
|
|
35
|
-
- **Breaking**: Remove synchronous compilation support. [#334](https://github.com/webpack-contrib/sass-loader/pull/334)
|
|
36
|
-
- **Breaking**: Remove official node-sass@3 and webpack@1 support. [5a6bcb96d8bd7a7a11c33252ba739ffe09ca38c5](https://github.com/webpack-contrib/sass-loader/commit/5a6bcb96d8bd7a7a11c33252ba739ffe09ca38c5)
|
|
37
|
-
- **Breaking**: Remove node 0.12 support. [29b30755021a834e622bf4b5bb9db4d6e5913905](https://github.com/webpack-contrib/sass-loader/commit/29b30755021a834e622bf4b5bb9db4d6e5913905)
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
<a name="6.0.7"></a>
|
|
34
|
+
## [6.0.7](https://github.com/webpack-contrib/sass-loader/compare/v6.0.6...v6.0.7) (2018-03-03)
|
|
40
35
|
|
|
41
|
-
- Update `webpack` peer dependency to support `2.2.0rc`. [#330](https://github.com/webpack-contrib/sass-loader/pull/330)
|
|
42
36
|
|
|
43
|
-
###
|
|
37
|
+
### Bug Fixes
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
* **package:** add `webpack >= v4.0.0` (`peerDependencies`) ([#541](https://github.com/webpack-contrib/sass-loader/issues/541)) ([620bdd4](https://github.com/webpack-contrib/sass-loader/commit/620bdd4))
|
|
46
40
|
|
|
47
|
-
### 4.0.2
|
|
48
41
|
|
|
49
|
-
|
|
42
|
+
### Performance Improvements
|
|
50
43
|
|
|
51
|
-
|
|
44
|
+
* use `neo-async` instead `async` ([#538](https://github.com/webpack-contrib/sass-loader/issues/538)) ([fab89dc](https://github.com/webpack-contrib/sass-loader/commit/fab89dc))
|
|
52
45
|
|
|
53
|
-
- Fix custom importers receiving `'stdin'` as second argument instead of the actual `resourcePath` [#267](https://github.com/webpack-contrib/sass-loader/pull/267)
|
|
54
46
|
|
|
55
|
-
### 4.0.0
|
|
56
47
|
|
|
57
|
-
|
|
48
|
+
<a name="6.0.6"></a>
|
|
49
|
+
## [6.0.6](https://github.com/webpack-contrib/sass-loader/compare/v6.0.5...v6.0.6) (2017-06-14)
|
|
58
50
|
|
|
59
|
-
###
|
|
51
|
+
### Chore
|
|
60
52
|
|
|
61
|
-
|
|
53
|
+
* Adds Webpack 3.x version range to peerDependencies
|
|
62
54
|
|
|
63
|
-
### 3.2.2
|
|
64
55
|
|
|
65
|
-
|
|
56
|
+
<a name="6.0.5"></a>
|
|
57
|
+
# [6.0.5](https://github.com/webpack-contrib/sass-loader/compare/v6.0.5...v6.0.4) (2017-05-10)
|
|
66
58
|
|
|
67
|
-
###
|
|
59
|
+
### Bug Fixes
|
|
68
60
|
|
|
69
|
-
|
|
61
|
+
* 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))
|
|
70
62
|
|
|
71
|
-
### 3.2.0
|
|
72
63
|
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
<a name="6.0.4"></a>
|
|
65
|
+
# [6.0.4](https://github.com/webpack-contrib/sass-loader/compare/v6.0.4...v6.0.3) (2017-05-09)
|
|
75
66
|
|
|
76
|
-
###
|
|
67
|
+
### Bug Fixes
|
|
77
68
|
|
|
78
|
-
|
|
79
|
-
- Update peer-dependencies [#182](https://github.com/webpack-contrib/sass-loader/pull/182)
|
|
80
|
-
- `node-sass@^3.4.2`
|
|
81
|
-
- `webpack@^1.12.6`
|
|
69
|
+
* fix: Resolving of scoped npm packages [#447](https://github.com/webpack-contrib/sass-loader/pull/447)
|
|
82
70
|
|
|
83
|
-
### 3.1.1
|
|
84
71
|
|
|
85
|
-
|
|
72
|
+
<a name="6.0.3"></a>
|
|
73
|
+
# [6.0.3](https://github.com/webpack-contrib/sass-loader/compare/v6.0.3...v6.0.2) (2017-03-07)
|
|
86
74
|
|
|
87
|
-
###
|
|
75
|
+
### Bug Fixes
|
|
88
76
|
|
|
89
|
-
|
|
90
|
-
- Fix a problem where modules with a `.` in their names were not resolved [#167](https://github.com/webpack-contrib/sass-loader/issues/167)
|
|
77
|
+
* Fix regression with empty files [#398](https://github.com/webpack-contrib/sass-loader/pull/398)
|
|
91
78
|
|
|
92
|
-
### 3.0.0
|
|
93
79
|
|
|
94
|
-
|
|
95
|
-
- Fix crash when Sass reported an error without `file` [#158](https://github.com/webpack-contrib/sass-loader/pull/158)
|
|
80
|
+
### Chore
|
|
96
81
|
|
|
97
|
-
|
|
82
|
+
* Reduce npm package size by using the [files](https://docs.npmjs.com/files/package.json#files) property in the `package.json`
|
|
98
83
|
|
|
99
|
-
- Add missing path normalization [#141](https://github.com/webpack-contrib/sass-loader/pull/141)
|
|
100
84
|
|
|
101
|
-
|
|
85
|
+
<a name="6.0.2"></a>
|
|
86
|
+
# [6.0.2](https://github.com/webpack-contrib/sass-loader/compare/v6.0.2...v6.0.1) (2017-02-21)
|
|
102
87
|
|
|
103
|
-
|
|
104
|
-
- 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)
|
|
105
|
-
- Fix path resolving on Windows [#108](https://github.com/webpack-contrib/sass-loader/issues/108)
|
|
106
|
-
- Fix file watchers on Windows [#102](https://github.com/webpack-contrib/sass-loader/issues/102)
|
|
107
|
-
- Fix file watchers for files with errors [#134](https://github.com/webpack-contrib/sass-loader/pull/134)
|
|
88
|
+
### Chore
|
|
108
89
|
|
|
109
|
-
|
|
90
|
+
* Update dependencies [#383](https://github.com/webpack-contrib/sass-loader/pull/383)
|
|
110
91
|
|
|
111
|
-
- Fix wrong source-map urls [#123](https://github.com/webpack-contrib/sass-loader/pull/123)
|
|
112
|
-
- Include source-map contents by default [#104](https://github.com/webpack-contrib/sass-loader/pull/104)
|
|
113
92
|
|
|
114
|
-
|
|
93
|
+
<a name="6.0.1"></a>
|
|
94
|
+
# [6.0.1](https://github.com/webpack-contrib/sass-loader/compare/v6.0.1...v6.0.0) (2017-02-17)
|
|
115
95
|
|
|
116
|
-
|
|
117
|
-
- 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)
|
|
96
|
+
### Bug Fixes
|
|
118
97
|
|
|
119
|
-
|
|
98
|
+
* Fix source maps in certain CWDs. [#377](https://github.com/webpack-contrib/sass-loader/pull/377)
|
|
120
99
|
|
|
121
|
-
- Fix a bug where files could not be imported across language styles [#73](https://github.com/webpack-contrib/sass-loader/issues/73)
|
|
122
|
-
- Update peer-dependency `node-sass` to `3.1.0`
|
|
123
100
|
|
|
124
|
-
|
|
101
|
+
<a name="6.0.0"></a>
|
|
102
|
+
# [6.0.0](https://github.com/webpack-contrib/sass-loader/compare/v6.0.0...v5.0.1) (2017-02-13)
|
|
125
103
|
|
|
126
|
-
|
|
127
|
-
- Update peer-dependency `node-sass` to `3.0.0-beta.4`
|
|
104
|
+
### Bug Fixes
|
|
128
105
|
|
|
129
|
-
|
|
106
|
+
* Improve source map support. [#374](https://github.com/webpack-contrib/sass-loader/issues/374)
|
|
130
107
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
108
|
+
|
|
109
|
+
### BREAKING CHANGES
|
|
110
|
+
|
|
111
|
+
* This is breaking for the resolve-url-loader
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
<a name="5.0.1"></a>
|
|
115
|
+
# [5.0.1](https://github.com/webpack-contrib/sass-loader/compare/v5.0.1...v5.0.0) (2017-02-13)
|
|
116
|
+
|
|
117
|
+
### Bug Fixes
|
|
118
|
+
|
|
119
|
+
* Fix bug where multiple compilations interfered with each other. [#369](https://github.com/webpack-contrib/sass-loader/pull/369)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
<a name="5.0.0"></a>
|
|
123
|
+
# [5.0.0](https://github.com/webpack-contrib/sass-loader/compare/v5.0.0...v4.1.1) (2017-02-13)
|
|
124
|
+
|
|
125
|
+
### Code Refactoring
|
|
126
|
+
|
|
127
|
+
* Remove synchronous compilation support [#334](https://github.com/webpack-contrib/sass-loader/pull/334)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### BREAKING CHANGES
|
|
131
|
+
|
|
132
|
+
* Remove node 0.12 support. [29b30755021a834e622bf4b5bb9db4d6e5913905](https://github.com/webpack-contrib/sass-loader/commit/29b30755021a834e622bf4b5bb9db4d6e5913905)
|
|
133
|
+
* Remove official node-sass@3 and webpack@1 support. [5a6bcb96d8bd7a7a11c33252ba739ffe09ca38c5](https://github.com/webpack-contrib/sass-loader/commit/5a6bcb96d8bd7a7a11c33252ba739ffe09ca38c5)
|
|
134
|
+
* Remove synchronous compilation support. [#334](https://github.com/webpack-contrib/sass-loader/pull/334)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
<a name="4.1.1"></a>
|
|
138
|
+
# [4.1.1](https://github.com/webpack-contrib/sass-loader/compare/v4.1.1...v4.1.0) (2016-12-21)
|
|
139
|
+
|
|
140
|
+
### Chore
|
|
141
|
+
|
|
142
|
+
* Update webpack peer dependency to support 2.2.0rc. [#330](https://github.com/webpack-contrib/sass-loader/pull/330)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
<a name="4.1.0"></a>
|
|
146
|
+
# [4.1.0](https://github.com/webpack-contrib/sass-loader/compare/v4.1.0...v4.0.2) (2016-12-14)
|
|
147
|
+
|
|
148
|
+
### Features
|
|
149
|
+
|
|
150
|
+
* Update `node-sass@4.0.0` [#319](https://github.com/webpack-contrib/sass-loader/pull/319)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
<a name="4.0.2"></a>
|
|
154
|
+
# [4.0.2](https://github.com/webpack-contrib/sass-loader/compare/v4.0.2...v4.0.1) (2016-07-07)
|
|
155
|
+
|
|
156
|
+
### Bug Fixes
|
|
157
|
+
|
|
158
|
+
* Fix wrong context in customImporters [#281](https://github.com/webpack-contrib/sass-loader/pull/281)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
<a name="4.0.1"></a>
|
|
162
|
+
# [4.0.1](https://github.com/webpack-contrib/sass-loader/compare/v4.0.1...v4.0.0) (2016-07-01)
|
|
163
|
+
|
|
164
|
+
### Bug Fixes
|
|
165
|
+
|
|
166
|
+
* Fix custom importers receiving `'stdin'` as second argument instead of the actual `resourcePath` [#267](https://github.com/webpack-contrib/sass-loader/pull/267)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
<a name="4.0.0"></a>
|
|
170
|
+
# [4.0.0](https://github.com/webpack-contrib/sass-loader/compare/v4.0.0...v3.2.2) (2016-06-27)
|
|
171
|
+
|
|
172
|
+
### Bug Fixes
|
|
173
|
+
|
|
174
|
+
* Fix incorrect source map paths [#250](https://github.com/webpack-contrib/sass-loader/pull/250)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
### BREAKING CHANGES
|
|
178
|
+
|
|
179
|
+
* Release new major version because the previous release was a breaking change in certain scenarios
|
|
180
|
+
See: https://github.com/webpack-contrib/sass-loader/pull/250#issuecomment-228663059
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
<a name="3.2.2"></a>
|
|
184
|
+
# [3.2.2](https://github.com/webpack-contrib/sass-loader/compare/v3.2.2...v3.2.1) (2016-06-26)
|
|
185
|
+
|
|
186
|
+
### Bug Fixes
|
|
187
|
+
|
|
188
|
+
* Fix incorrect source map paths [#250](https://github.com/webpack-contrib/sass-loader/pull/250)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
<a name="3.2.1"></a>
|
|
192
|
+
# [3.2.1](https://github.com/webpack-contrib/sass-loader/compare/v3.2.1...v3.2.0) (2016-06-19)
|
|
193
|
+
|
|
194
|
+
### Bug Fixes
|
|
195
|
+
|
|
196
|
+
* Add `webpack@^2.1.0-beta` as peer dependency [#233](https://github.com/webpack-contrib/sass-loader/pull/233)
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
<a name="3.2.0"></a>
|
|
200
|
+
# [3.2.0](https://github.com/webpack-contrib/sass-loader/compare/v3.2.0...v3.1.2) (2016-03-12)
|
|
201
|
+
|
|
202
|
+
### Features
|
|
203
|
+
|
|
204
|
+
* Append file content instead of overwriting when `data`-option is already present [#216](https://github.com/webpack-contrib/sass-loader/pull/216)
|
|
205
|
+
* Make `indentedSyntax` option a bit smarter [#196](https://github.com/webpack-contrib/sass-loader/pull/196)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
<a name="3.1.2"></a>
|
|
209
|
+
# [3.1.2](https://github.com/webpack-contrib/sass-loader/compare/v3.1.2...v3.1.1) (2015-11-22)
|
|
210
|
+
|
|
211
|
+
### Bug Fixes
|
|
212
|
+
|
|
213
|
+
* Fix loader query not overriding webpack config [#189](https://github.com/webpack-contrib/sass-loader/pull/189)
|
|
214
|
+
* Update peer-dependencies [#182](https://github.com/webpack-contrib/sass-loader/pull/182)
|
|
215
|
+
- `node-sass^3.4.2`
|
|
216
|
+
- `webpack^1.12.6`
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
<a name="3.1.1"></a>
|
|
220
|
+
# [3.1.1](https://github.com/webpack-contrib/sass-loader/compare/v3.1.1...v3.1.0) (2015-10-26)
|
|
221
|
+
|
|
222
|
+
### Bug Fixes
|
|
223
|
+
|
|
224
|
+
* Fix missing module `object-assign` [#178](https://github.com/webpack-contrib/sass-loader/issues/178)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
<a name="3.1.0"></a>
|
|
228
|
+
# [3.1.0](https://github.com/webpack-contrib/sass-loader/compare/v3.1.0...v3.0.0) (2015-10-25)
|
|
229
|
+
|
|
230
|
+
### Bug Fixes
|
|
231
|
+
|
|
232
|
+
* Fix a problem where modules with a `.` in their names were not resolved [#167](https://github.com/webpack-contrib/sass-loader/issues/167)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
### Features
|
|
236
|
+
|
|
237
|
+
* 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)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
<a name="3.0.0"></a>
|
|
241
|
+
# [3.0.0](https://github.com/webpack-contrib/sass-loader/compare/v3.0.0...v2.0.1) (2015-09-29)
|
|
242
|
+
|
|
243
|
+
### Bug Fixes
|
|
244
|
+
|
|
245
|
+
* Fix crash when Sass reported an error without `file` [#158](https://github.com/webpack-contrib/sass-loader/pull/158)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
### BREAKING CHANGES
|
|
249
|
+
|
|
250
|
+
* 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)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
<a name="2.0.1"></a>
|
|
254
|
+
# [2.0.1](https://github.com/webpack-contrib/sass-loader/compare/v2.0.1...v2.0.0) (2015-08-14)
|
|
255
|
+
|
|
256
|
+
### Bug Fixes
|
|
257
|
+
|
|
258
|
+
* Add missing path normalization (fixes [#141](https://github.com/webpack-contrib/sass-loader/pull/141))
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
<a name="2.0.0"></a>
|
|
262
|
+
# [2.0.0](https://github.com/webpack-contrib/sass-loader/compare/v2.0.0...v1.0.4) (2015-08-06)
|
|
263
|
+
|
|
264
|
+
### Bug Fixes
|
|
265
|
+
|
|
266
|
+
* 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)
|
|
267
|
+
* Fix path resolving on Windows [#108](https://github.com/webpack-contrib/sass-loader/issues/108)
|
|
268
|
+
* Fix file watchers on Windows [#102](https://github.com/webpack-contrib/sass-loader/issues/102)
|
|
269
|
+
* Fix file watchers for files with errors [#134](https://github.com/webpack-contrib/sass-loader/pull/134)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
### Code Refactoring
|
|
273
|
+
|
|
274
|
+
* 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))
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
### BREAKING CHANGES
|
|
278
|
+
|
|
279
|
+
* 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)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
<a name="1.0.4"></a>
|
|
283
|
+
# [1.0.4](https://github.com/webpack-contrib/sass-loader/compare/v1.0.4...v1.0.3) (2015-08-03)
|
|
284
|
+
|
|
285
|
+
### Bug Fixes
|
|
286
|
+
|
|
287
|
+
* Fix wrong source-map urls [#123](https://github.com/webpack-contrib/sass-loader/pull/123)
|
|
288
|
+
* Include source-map contents by default [#104](https://github.com/webpack-contrib/sass-loader/pull/104)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
<a name="1.0.3"></a>
|
|
292
|
+
# [1.0.3](https://github.com/webpack-contrib/sass-loader/compare/v1.0.3...v1.0.2) (2015-07-22)
|
|
293
|
+
|
|
294
|
+
### Bug Fixes
|
|
295
|
+
|
|
296
|
+
* Fix importing css files from scss/sass [#101](https://github.com/webpack-contrib/sass-loader/issues/101)
|
|
297
|
+
* 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)
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
<a name="1.0.2"></a>
|
|
301
|
+
# [1.0.2](https://github.com/webpack-contrib/sass-loader/compare/v1.0.2...v1.0.1) (2015-04-15)
|
|
302
|
+
|
|
303
|
+
### Bug Fixes
|
|
304
|
+
|
|
305
|
+
* Fix a bug where files could not be imported across language styles [#73](https://github.com/webpack-contrib/sass-loader/issues/73)
|
|
306
|
+
* Update peer-dependency `node-sass` to `3.1.0`
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
<a name="1.0.1"></a>
|
|
310
|
+
# [1.0.1](https://github.com/webpack-contrib/sass-loader/compare/v1.0.1...v1.0.0) (2015-03-31)
|
|
311
|
+
|
|
312
|
+
### Bug Fixes
|
|
313
|
+
|
|
314
|
+
* Fix Sass partials not being resolved anymore [#68](https://github.com/webpack-contrib/sass-loader/issues/68)
|
|
315
|
+
* Update peer-dependency `node-sass` to `3.0.0-beta.4`
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
<a name="1.0.0"></a>
|
|
319
|
+
# [1.0.0](https://github.com/webpack-contrib/sass-loader/compare/v1.0.0...v0.3.1) (2015-03-22)
|
|
320
|
+
|
|
321
|
+
### Bug Fixes
|
|
322
|
+
|
|
323
|
+
* Moved `node-sass^3.0.0-alpha.0` to `peerDependencies` [#28](https://github.com/webpack-contrib/sass-loader/issues/28)
|
|
324
|
+
* Using webpack's module resolver as custom importer [#39](https://github.com/webpack-contrib/sass-loader/issues/31)
|
|
325
|
+
* 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/README.md
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
<img width="200" height="200"
|
|
15
15
|
src="https://webpack.js.org/assets/icon-square-big.svg">
|
|
16
16
|
</a>
|
|
17
|
-
<h1>
|
|
18
|
-
<p>Loads a
|
|
17
|
+
<h1>Sass Loader</h1>
|
|
18
|
+
<p>Loads a Sass/SCSS file and compiles it to CSS.</p>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
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.
|
|
@@ -34,6 +34,10 @@ as [`peerDependency`](https://docs.npmjs.com/files/package.json#peerdependencies
|
|
|
34
34
|
|
|
35
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.
|
|
36
36
|
|
|
37
|
+
```bash
|
|
38
|
+
npm install style-loader css-loader --save-dev
|
|
39
|
+
```
|
|
40
|
+
|
|
37
41
|
```js
|
|
38
42
|
// webpack.config.js
|
|
39
43
|
module.exports = {
|
|
@@ -134,7 +138,7 @@ Since Sass/[libsass](https://github.com/sass/libsass) does not provide [url rewr
|
|
|
134
138
|
|
|
135
139
|
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:
|
|
136
140
|
|
|
137
|
-
- Add the missing url rewriting using the [resolve-url-loader](https://github.com/bholloway/resolve-url-loader). Place it
|
|
141
|
+
- Add the missing url rewriting using the [resolve-url-loader](https://github.com/bholloway/resolve-url-loader). Place it before the sass-loader in the loader chain.
|
|
138
142
|
- 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).
|
|
139
143
|
|
|
140
144
|
### Extracting style sheets
|
|
@@ -227,11 +231,11 @@ If you want to prepend Sass code before the actual entry file, you can set the `
|
|
|
227
231
|
[travis]: http://img.shields.io/travis/webpack-contrib/sass-loader.svg
|
|
228
232
|
[travis-url]: https://travis-ci.org/webpack-contrib/sass-loader
|
|
229
233
|
|
|
230
|
-
[appveyor-url]: https://ci.appveyor.com/project/
|
|
231
|
-
[appveyor]: https://ci.appveyor.com/api/projects/status/
|
|
234
|
+
[appveyor-url]: https://ci.appveyor.com/project/webpack-contrib/sass-loader/branch/master
|
|
235
|
+
[appveyor]: https://ci.appveyor.com/api/projects/status/rqpy1vaovh20ttxs/branch/master?svg=true
|
|
232
236
|
|
|
233
|
-
[cover]: https://
|
|
234
|
-
[cover-url]: https://
|
|
237
|
+
[cover]: https://codecov.io/gh/webpack-contrib/sass-loader/branch/master/graph/badge.svg
|
|
238
|
+
[cover-url]: https://codecov.io/gh/webpack-contrib/sass-loader
|
|
235
239
|
|
|
236
240
|
[chat]: https://badges.gitter.im/webpack/webpack.svg
|
|
237
241
|
[chat-url]: https://gitter.im/webpack/webpack
|
package/lib/formatSassError.js
CHANGED
|
@@ -62,7 +62,7 @@ function getFileExcerptIfPossible(err) {
|
|
|
62
62
|
|
|
63
63
|
return os.EOL +
|
|
64
64
|
content.split(os.EOL)[err.line - 1] + os.EOL +
|
|
65
|
-
new Array(
|
|
65
|
+
new Array(err.column - 1).join(" ") + "^" + os.EOL +
|
|
66
66
|
" ";
|
|
67
67
|
} catch (err) {
|
|
68
68
|
// If anything goes wrong here, we don't want any errors to be reported to the user
|
package/lib/importsToResolve.js
CHANGED
|
@@ -1,58 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const path = require("path");
|
|
4
|
+
const utils = require("loader-utils");
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
const extPrecedence = [".scss", ".sass", ".css"];
|
|
6
|
+
const matchModuleImport = /^~([^\/]+|@[^\/]+[\/][^\/]+)$/g;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* When libsass tries to resolve an import, it uses a special algorithm.
|
|
10
10
|
* Since the sass-loader uses webpack to resolve the modules, we need to simulate that algorithm. This function
|
|
11
|
-
* returns an array of import paths to try.
|
|
11
|
+
* returns an array of import paths to try. The last entry in the array is always the original url
|
|
12
|
+
* to enable straight-forward webpack.config aliases.
|
|
12
13
|
*
|
|
13
|
-
* @param {string}
|
|
14
|
+
* @param {string} url
|
|
14
15
|
* @returns {Array<string>}
|
|
15
16
|
*/
|
|
16
|
-
function importsToResolve(
|
|
17
|
+
function importsToResolve(url) {
|
|
18
|
+
const request = utils.urlToRequest(url);
|
|
19
|
+
// Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot.
|
|
20
|
+
// @see https://github.com/webpack-contrib/sass-loader/issues/167
|
|
21
|
+
const ext = path.extname(request);
|
|
22
|
+
|
|
23
|
+
if (matchModuleImport.test(url)) {
|
|
24
|
+
return [request, url];
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
// libsass' import algorithm works like this:
|
|
18
|
-
|
|
19
|
-
// - Prefer modules starting with '_'.
|
|
20
|
-
// - File extension precedence: .scss, .sass, .css.
|
|
28
|
+
|
|
21
29
|
// In case there is a file extension...
|
|
22
30
|
// - If the file is a CSS-file, do not include it all, but just link it via @import url().
|
|
23
31
|
// - The exact file name must match (no auto-resolving of '_'-modules).
|
|
32
|
+
if (ext === ".css") {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
if (ext === ".scss" || ext === ".sass") {
|
|
36
|
+
return [request, url];
|
|
37
|
+
}
|
|
24
38
|
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
|
|
39
|
+
// In case there is no file extension...
|
|
40
|
+
// - Prefer modules starting with '_'.
|
|
41
|
+
// - File extension precedence: .scss, .sass, .css.
|
|
28
42
|
const basename = path.basename(request);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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);
|
|
43
|
+
|
|
44
|
+
if (basename.charAt(0) === "_") {
|
|
45
|
+
return [
|
|
46
|
+
`${ request }.scss`, `${ request }.sass`, `${ request }.css`,
|
|
47
|
+
url
|
|
48
|
+
];
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
).map(
|
|
54
|
-
file => dirname + "/" + file // No path.sep required here, because imports inside SASS are usually with /
|
|
55
|
-
);
|
|
51
|
+
const dirname = path.dirname(request);
|
|
52
|
+
|
|
53
|
+
return [
|
|
54
|
+
`${ dirname }/_${ basename }.scss`, `${ dirname }/_${ basename }.sass`, `${ dirname }/_${ basename }.css`,
|
|
55
|
+
`${ request }.scss`, `${ request }.sass`, `${ request }.css`,
|
|
56
|
+
url
|
|
57
|
+
];
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
module.exports = importsToResolve;
|
package/lib/loader.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const sass = require("node-sass");
|
|
4
3
|
const path = require("path");
|
|
5
|
-
const async = require("async");
|
|
4
|
+
const async = require("neo-async");
|
|
6
5
|
const formatSassError = require("./formatSassError");
|
|
7
6
|
const webpackImporter = require("./webpackImporter");
|
|
8
7
|
const normalizeOptions = require("./normalizeOptions");
|
|
@@ -12,7 +11,7 @@ const pify = require("pify");
|
|
|
12
11
|
// fs tasks when running the custom importer code.
|
|
13
12
|
// This can be removed as soon as node-sass implements a fix for this.
|
|
14
13
|
const threadPoolSize = process.env.UV_THREADPOOL_SIZE || 4;
|
|
15
|
-
|
|
14
|
+
let asyncSassJobQueue = null;
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* The sass-loader makes node-sass available to webpack modules.
|
|
@@ -21,6 +20,28 @@ const asyncSassJobQueue = async.queue(sass.render, threadPoolSize - 1);
|
|
|
21
20
|
* @param {string} content
|
|
22
21
|
*/
|
|
23
22
|
function sassLoader(content) {
|
|
23
|
+
if (asyncSassJobQueue === null) {
|
|
24
|
+
let sass;
|
|
25
|
+
let sassVersion;
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
sass = require("node-sass");
|
|
29
|
+
sassVersion = /^(\d+)/.exec(require("node-sass/package.json").version).pop();
|
|
30
|
+
} catch (e) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
"`sass-loader` requires `node-sass` >=4. Please install a compatible version."
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (Number(sassVersion) < 4) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
"The installed version of `node-sass` is not compatible (expected: >= 4, actual: " + sassVersion + ")."
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
asyncSassJobQueue = async.queue(sass.render, threadPoolSize - 1);
|
|
43
|
+
}
|
|
44
|
+
|
|
24
45
|
const callback = this.async();
|
|
25
46
|
const isSync = typeof callback !== "function";
|
|
26
47
|
const self = this;
|
|
@@ -35,8 +56,6 @@ function sassLoader(content) {
|
|
|
35
56
|
throw new Error("Synchronous compilation is not supported anymore. See https://github.com/webpack-contrib/sass-loader/issues/333");
|
|
36
57
|
}
|
|
37
58
|
|
|
38
|
-
this.cacheable();
|
|
39
|
-
|
|
40
59
|
const options = normalizeOptions(this, content, webpackImporter(
|
|
41
60
|
resourcePath,
|
|
42
61
|
pify(this.resolve.bind(this)),
|
package/lib/webpackImporter.js
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
const path = require("path");
|
|
20
|
-
const utils = require("loader-utils");
|
|
21
20
|
const tail = require("lodash.tail");
|
|
22
21
|
const importsToResolve = require("./importsToResolve");
|
|
23
22
|
|
|
@@ -63,7 +62,7 @@ function webpackImporter(resourcePath, resolve, addNormalizedDependency) {
|
|
|
63
62
|
return (url, prev, done) => {
|
|
64
63
|
startResolving(
|
|
65
64
|
dirContextFrom(prev),
|
|
66
|
-
importsToResolve(
|
|
65
|
+
importsToResolve(url)
|
|
67
66
|
) // Catch all resolving errors, return the original file and pass responsibility back to other custom importers
|
|
68
67
|
.catch(() => ({ file: url }))
|
|
69
68
|
.then(done);
|
package/package.json
CHANGED
|
@@ -1,67 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sass-loader",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
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
|
-
"
|
|
14
|
+
"lint": "eslint lib test",
|
|
9
15
|
"test": "nyc --all mocha -R spec -t 10000",
|
|
10
|
-
"posttest": "npm run lint",
|
|
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
20
|
"test-hmr": "webpack-dev-server --config test/hmr/webpack.config.js --content-base ./test/hmr --hot --inline",
|
|
16
|
-
"lint": "
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"webpack",
|
|
23
|
-
"loader"
|
|
24
|
-
],
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "git://github.com/webpack-contrib/sass-loader.git"
|
|
28
|
-
},
|
|
29
|
-
"author": "J. Tangelder",
|
|
30
|
-
"license": "MIT",
|
|
31
|
-
"engines": {
|
|
32
|
-
"node": ">=4.0.0"
|
|
33
|
-
},
|
|
34
|
-
"peerDependencies": {
|
|
35
|
-
"node-sass": "^4.0.0",
|
|
36
|
-
"webpack": "^2.0.0"
|
|
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"
|
|
37
27
|
},
|
|
38
28
|
"dependencies": {
|
|
39
|
-
"
|
|
40
|
-
"clone-deep": "^0.2.4",
|
|
29
|
+
"clone-deep": "^2.0.1",
|
|
41
30
|
"loader-utils": "^1.0.1",
|
|
42
31
|
"lodash.tail": "^4.1.1",
|
|
43
|
-
"
|
|
32
|
+
"neo-async": "^2.5.0",
|
|
33
|
+
"pify": "^3.0.0"
|
|
44
34
|
},
|
|
45
35
|
"devDependencies": {
|
|
46
36
|
"bootstrap-sass": "^3.3.5",
|
|
47
|
-
"css-loader": "^0.
|
|
37
|
+
"css-loader": "^0.28.4",
|
|
48
38
|
"eslint": "^3.16.0",
|
|
49
39
|
"eslint-config-peerigon": "^9.0.0",
|
|
50
40
|
"eslint-plugin-jsdoc": "^2.4.0",
|
|
51
|
-
"file-loader": "^0.
|
|
41
|
+
"file-loader": "^0.11.2",
|
|
52
42
|
"mocha": "^3.0.2",
|
|
43
|
+
"mock-require": "^3.0.1",
|
|
53
44
|
"node-sass": "^4.5.0",
|
|
54
|
-
"nyc": "^
|
|
45
|
+
"nyc": "^11.0.2",
|
|
55
46
|
"raw-loader": "^0.5.1",
|
|
56
47
|
"should": "^11.2.0",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
48
|
+
"standard-version": "^4.2.0",
|
|
49
|
+
"style-loader": "^0.18.2",
|
|
50
|
+
"webpack": "^4.5.0",
|
|
59
51
|
"webpack-dev-server": "^2.4.1",
|
|
60
|
-
"webpack-merge": "^
|
|
52
|
+
"webpack-merge": "^4.0.0"
|
|
61
53
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">= 6.9.0 || >= 8.9.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"webpack": "^3.0.0 || ^4.0.0"
|
|
59
|
+
},
|
|
60
|
+
"keywords": [
|
|
61
|
+
"sass",
|
|
62
|
+
"libsass",
|
|
63
|
+
"webpack",
|
|
64
|
+
"loader"
|
|
65
|
+
],
|
|
66
|
+
"repository": "https://github.com/webpack-contrib/sass-loader.git",
|
|
67
|
+
"bugs": "https://github.com/webpack-contrib/sass-loader/issues",
|
|
68
|
+
"homepage": "https://github.com/webpack-contrib/sass-loader"
|
|
67
69
|
}
|