StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
StackGenVis/frontend/node_modules/vue-cli-plugin-vuetify/util/helpers.js

74 lines
1.8 KiB

4 years ago
// Imports
const semver = require('semver')
const fs = require('fs')
// Check for existence of file and add import
function addImport (api, file, data, folder, end) {
// sass & scss file types
for (const ext of ['sass', 'scss']) {
const path = `${folder}/${file}.${ext}`
// If file doesn't exist in user
// project, continue to next
if (!fileExists(api, `src/${path}`)) continue
// If file exists, push it into
// the import statement
data.push(`@import '@/${path}${end}`)
}
}
// Go through each folder and add available imports
function addImports (api, file, data, end) {
// supported folders that can contain
// a variables or lists file
for (const folder of ['sass', 'scss', 'styles']) {
addImport(api, file, data, folder, end)
}
}
// Check if file exists in user project
function fileExists (api, file) {
return fs.existsSync(api.resolve(file))
}
// Create an import statement
// to bootstrap a users variables
function mergeRules (api, opt, ext) {
const data = []
const end = ext === 'sass' ? "'" : "';"
addImports(api, 'variables', data, end)
// If user isn't supplying variables, avoid prepending data
if (!data.length) return opt
// Inject Vuetify styles at the end of user supplied
data.push(`@import '~vuetify/src/styles/styles.sass${end}`)
let sassLoaderVersion
try {
sassLoaderVersion = semver.major(require('sass-loader/package.json').version)
} catch (e) {}
// Merge with user-defined loader data config
if (sassLoaderVersion < 8) {
if (opt.data) data.unshift(opt.data)
opt.data = data.join('\n')
} else {
if (opt.prependData) data.unshift(opt.prependData)
opt.prependData = data.join('\n')
}
return opt
}
module.exports = {
addImport,
addImports,
fileExists,
mergeRules,
}