(path)
| 1 | module.exports = { |
| 2 | $themePath (path) { |
| 3 | // Get the body element |
| 4 | const body = document.body |
| 5 | |
| 6 | // Regular expression to match any theme |
| 7 | const themeRegex = /(\w+)-theme/ |
| 8 | |
| 9 | // Find the theme in the body's class list |
| 10 | const themeMatch = [...body.classList].find(className => themeRegex.test(className)) |
| 11 | |
| 12 | if (themeMatch) { |
| 13 | // Extract the theme name |
| 14 | const themeName = themeMatch.match(themeRegex)[1] |
| 15 | |
| 16 | if (themeName === 'blue') { |
| 17 | return path |
| 18 | } |
| 19 | |
| 20 | // Split the path into parts |
| 21 | const parts = path.split('.') |
| 22 | |
| 23 | // Add '_' + themeName to the last part before '.js' |
| 24 | parts[parts.length - 2] += `__${themeName}` |
| 25 | |
| 26 | // Join the parts back together |
| 27 | path = parts.join('.') |
| 28 | } |
| 29 | |
| 30 | return path |
| 31 | } |
| 32 | } |
nothing calls this directly
no outgoing calls
no test coverage detected