Skip to content

Commit f4e6c33

Browse files
authored
chore!: default to dart sass for sass option of cssPreprocessor (#3921)
BREAKING CHANGE: Preset generated before v3.4.0 may contain a `"cssPreprocessor": "sass"` field. It now means dart-sass rather than node-sass. `rootOptions.cssPreprocessor === 'sass'` now also means dart sass. May affect those generator plugins who depends on this field
1 parent b823bae commit f4e6c33

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

packages/@vue/cli-service/__tests__/generator.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const generateWithPlugin = require('@vue/cli-test-utils/generateWithPlugin')
22

3-
test('node sass (legacy)', async () => {
3+
test('sass (default)', async () => {
44
const { pkg, files } = await generateWithPlugin([
55
{
66
id: '@vue/cli-service',
@@ -12,7 +12,7 @@ test('node sass (legacy)', async () => {
1212
])
1313

1414
expect(files['src/App.vue']).toMatch('<style lang="scss">')
15-
expect(pkg).toHaveProperty(['devDependencies', 'node-sass'])
15+
expect(pkg).toHaveProperty(['devDependencies', 'sass'])
1616
})
1717

1818
test('node sass', async () => {

packages/@vue/cli-service/generator/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ module.exports = (api, options) => {
3535

3636
if (options.cssPreprocessor) {
3737
const deps = {
38-
// TODO: remove 'sass' option in v4 or rename 'dart-sass' to 'sass'
3938
sass: {
40-
'node-sass': '^4.9.0',
39+
sass: '^1.19.0',
4140
'sass-loader': '^7.1.0'
4241
},
4342
'node-sass': {
44-
'node-sass': '^4.9.0',
43+
'node-sass': '^4.12.0',
4544
'sass-loader': '^7.1.0'
4645
},
4746
'dart-sass': {

packages/@vue/cli/lib/options.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const presetSchema = createSchema(joi => joi.object().keys({
1313
router: joi.boolean(),
1414
routerHistoryMode: joi.boolean(),
1515
vuex: joi.boolean(),
16-
// TODO: remove 'sass' or make it equivalent to 'dart-sass' in v4
1716
cssPreprocessor: joi.string().only(['sass', 'dart-sass', 'node-sass', 'less', 'stylus']),
1817
plugins: joi.object().required(),
1918
configs: joi.object()

packages/@vue/cli/lib/util/inferRootOptions.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ module.exports = function inferRootOptions (pkg) {
2020

2121
// cssPreprocessors
2222
if ('sass' in deps) {
23-
rootOptions.cssPreprocessor = 'dart-sass'
24-
} else if ('node-sass' in deps) {
25-
// TODO: change to 'node-sass' in v4
2623
rootOptions.cssPreprocessor = 'sass'
24+
} else if ('node-sass' in deps) {
25+
rootOptions.cssPreprocessor = 'node-sass'
2726
} else if ('less-loader' in deps) {
2827
rootOptions.cssPreprocessor = 'less'
2928
} else if ('stylus-loader' in deps) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy