Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
loadPlugins (config) {
const { plugins } = config
if (isPureObject(plugins)) {
// Map postcss plugins into instances on object mode once
config.plugins = this.sortPlugins(config)
.map((p) => {
const plugin = this.buildContext.nuxt.resolver.requireModule(p)
const opts = plugins[p]
if (opts === false) {
return // Disabled
}
return plugin(opts)
})
.filter(Boolean)
}
}
config () {
/* istanbul ignore if */
if (!this.postcssOptions) {
return false
}
let config = this.configFromFile()
if (config) {
return config
}
config = this.normalize(cloneDeep(this.postcssOptions))
// Apply default plugins
if (isPureObject(config)) {
if (config.preset) {
this.preset = config.preset
delete config.preset
}
if (Array.isArray(config.plugins)) {
defaults(config, this.defaultConfig)
} else {
// Keep the order of default plugins
config = merge({}, this.defaultConfig, config)
this.loadPlugins(config)
}
return config
}
}
}
}
// If store defined, update store options to true unless explicitly disabled
if (
options.store !== false &&
fs.existsSync(path.join(options.srcDir, options.dir.store)) &&
fs.readdirSync(path.join(options.srcDir, options.dir.store))
.find(filename => filename !== 'README.md' && filename[0] !== '.')
) {
options.store = true
}
// SPA loadingIndicator
if (options.loadingIndicator) {
// Normalize loadingIndicator
if (!isPureObject(options.loadingIndicator)) {
options.loadingIndicator = { name: options.loadingIndicator }
}
// Apply defaults
options.loadingIndicator = Object.assign(
{
name: 'default',
color: (options.loading && options.loading.color) || '#D3D3D3',
color2: '#F5F5F5',
background: (options.manifest && options.manifest.theme_color) || 'white',
dev: options.dev,
loading: options.messages.loading
},
options.loadingIndicator
)
}