Skip to content

Commit

Permalink
build(vite): stringify scope version in SASS
Browse files Browse the repository at this point in the history
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
  • Loading branch information
ShGKme committed Feb 29, 2024
1 parent 9c1ef48 commit 5bbfb69
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cypress.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default defineConfig({
devSourcemap: true,
preprocessorOptions: {
scss: {
additionalData: `@use 'sass:math'; $scope_version:${SCOPE_VERSION}; @import 'variables'; @import 'material-icons';`,
additionalData: `@use 'sass:math'; $scope_version: ${SCOPE_VERSION}; @import 'variables'; @import 'material-icons';`,
sourceMapContents: false,
includePaths: [
resolve(__dirname, 'src/assets'),
Expand Down
5 changes: 3 additions & 2 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import l10nPlugin from './build/l10n-plugin.mts'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))

const appVersion = JSON.stringify(process.env.npm_package_version || 'nextcloud-vue')
const SCOPE_VERSION = md5(appVersion).slice(0, 7) as string
const versionHash = md5(appVersion).slice(0, 7) as string
const SCOPE_VERSION = JSON.stringify(versionHash)

// Entry points which we build using vite
const entryPoints = {
Expand Down Expand Up @@ -81,7 +82,7 @@ const overrides = defineConfig({
devSourcemap: true,
preprocessorOptions: {
scss: {
additionalData: `@use 'sass:math'; $scope_version:${SCOPE_VERSION}; @import 'variables'; @import 'material-icons';`,
additionalData: `@use 'sass:math'; $scope_version: ${SCOPE_VERSION}; @import 'variables'; @import 'material-icons';`,
sourceMapContents: false,
includePaths: [
resolve(__dirname, 'src/assets'),
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ webpackConfig.devtool = isDev ? false : 'source-map'
const sassLoader = {
loader: 'sass-loader',
options: {
additionalData: `@use 'sass:math'; $scope_version:${SCOPE_VERSION}; @import 'variables'; @import 'material-icons';`,
additionalData: `@use 'sass:math'; $scope_version: ${SCOPE_VERSION}; @import 'variables'; @import 'material-icons';`,
/**
* ! needed for resolve-url-loader
*/
Expand Down

0 comments on commit 5bbfb69

Please sign in to comment.