Replies: 3 comments 4 replies
-
|
Heres my const fs = require('fs')
const path = require('path')
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
const getScssAdditional = (...paths) => {
return paths.reduce((acc, curr) => {
return acc + fs.readFileSync(curr, 'utf-8')
}, '')
}
export default defineConfig({
plugins: [vue()],
alias: {
'@': path.resolve(__dirname, 'src')
},
css: {
preprocessorOptions: {
scss: {
additionalData: getScssAdditional(
'src/style/variables.scss',
)
}
}
}
}) |
Beta Was this translation helpful? Give feedback.
4 replies
-
|
@JackLiR8 Thanks for your answer. I am stuck in this about mutiple entry points. My config: build: {
rollupOptions: {
input: {
front: resolve('pages/front.html'),
admin: resolve('pages/admin.html'),
},
},
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
additionalData: (source, filename) => {
const configFile = filename.includes('page-front')
? '@import "./src/page-front/style/config.less";'
: '@import "./src/page-admin/style/config.less";';
return `${configFile} ${source}`;
},
},
},
},But I have common components under Could you help me to out of this? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Is there a solution if I use css modules + postcss, not sass/less/stylus? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
hi:
When I use less to write the style, I want to inject less variables into vite.config.ts globally, just like the 'style-resources-loader' plugin.
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
patterns: [path.resolve(__dirname, "./src/theme/color.less")],
}
},
What should I do, please?
Beta Was this translation helpful? Give feedback.
All reactions