forked from vuejs/vue-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcssPreprocessors.js
46 lines (43 loc) · 1.39 KB
/
cssPreprocessors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module.exports = cli => {
cli.injectFeature({
name: 'CSS Pre-processors',
value: 'css-preprocessor',
description: 'Add support for CSS pre-processors like Sass, Less or Stylus',
link: 'https://cli.vuejs.org/guide/css.html'
})
const notice = 'PostCSS, Autoprefixer and CSS Modules are supported by default'
cli.injectPrompt({
name: 'cssPreprocessor',
when: answers => answers.features.includes('css-preprocessor'),
type: 'list',
message: `Pick a CSS pre-processor${process.env.VUE_CLI_API_MODE ? '' : ` (${notice})`}:`,
description: `${notice}.`,
choices: [
// In Vue CLI <= 3.3, the value of Sass option in 'sass' an means 'node-sass'.
// Considering the 'sass' package on NPM is actually for Dart Sass, we renamed it to 'node-sass'.
// In @vue/cli-service there're still codes that accepts 'sass' as an option value, for compatibility reasons,
// and they're meant to be removed in v4.
{
name: 'Sass/SCSS (with dart-sass)',
value: 'dart-sass'
},
{
name: 'Sass/SCSS (with node-sass)',
value: 'node-sass'
},
{
name: 'Less',
value: 'less'
},
{
name: 'Stylus',
value: 'stylus'
}
]
})
cli.onPromptComplete((answers, options) => {
if (answers.cssPreprocessor) {
options.cssPreprocessor = answers.cssPreprocessor
}
})
}