Skip to content

Commit c123fef

Browse files
authored
feat: add nuxt build indicator to whitelist in dev mode (#85)
1 parent 9345ebf commit c123fef

File tree

1 file changed

+37
-29
lines changed

1 file changed

+37
-29
lines changed

lib/utils.js

+37-29
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,41 @@ const MODES = {
55

66
module.exports = {
77
MODES,
8-
getDefaults: options => ({
9-
mode: MODES.postcss,
10-
enabled: options.dev === false,
11-
paths: [
12-
'components/**/*.vue',
13-
'layouts/**/*.vue',
14-
'pages/**/*.vue',
15-
'plugins/**/*.js',
16-
'nuxt.config.js'
17-
],
18-
styleExtensions: ['.css'],
19-
whitelist: ['body', 'html', 'nuxt-progress', '__nuxt', '__layout'],
20-
whitelistPatterns: [
21-
/-(leave|enter|appear)(|-(to|from|active))$/, // Normal transitions
22-
/^nuxt-link(|-exact)-active$/, // Nuxt link classes
23-
/^(?!cursor-move).+-move$/, // Move transitions
24-
/data-v-.*/ // Keep scoped styles
25-
],
26-
whitelistPatternsChildren: [],
27-
extractors: [
28-
{
29-
extractor: (content) => {
30-
const contentWithoutStyleBlocks = content.replace(/<style[^]+?<\/style>/gi, '') // Remove inline vue styles
31-
return contentWithoutStyleBlocks.match(/[\w-.:/]+(?<!:)/g) || []
32-
},
33-
extensions: ['html', 'vue', 'js']
34-
}
35-
]
36-
})
8+
getDefaults (options) {
9+
const defaults = {
10+
mode: MODES.postcss,
11+
enabled: options.dev === false,
12+
paths: [
13+
'components/**/*.vue',
14+
'layouts/**/*.vue',
15+
'pages/**/*.vue',
16+
'plugins/**/*.js',
17+
'nuxt.config.js'
18+
],
19+
styleExtensions: ['.css'],
20+
whitelist: ['body', 'html', 'nuxt-progress', '__nuxt', '__layout'],
21+
whitelistPatterns: [
22+
/-(leave|enter|appear)(|-(to|from|active))$/, // Normal transitions
23+
/^nuxt-link(|-exact)-active$/, // Nuxt link classes
24+
/^(?!cursor-move).+-move$/, // Move transitions
25+
/data-v-.*/ // Keep scoped styles
26+
],
27+
whitelistPatternsChildren: [],
28+
extractors: [
29+
{
30+
extractor: (content) => {
31+
const contentWithoutStyleBlocks = content.replace(/<style[^]+?<\/style>/gi, '') // Remove inline vue styles
32+
return contentWithoutStyleBlocks.match(/[\w-.:/]+(?<!:)/g) || []
33+
},
34+
extensions: ['html', 'vue', 'js']
35+
}
36+
]
37+
}
38+
39+
if (options.dev) {
40+
defaults.whitelist.push('nuxt__build_indicator')
41+
}
42+
43+
return defaults
44+
}
3745
}

0 commit comments

Comments
 (0)