Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override theme with auto import #2

Open
rahulpatel033 opened this issue Mar 30, 2022 · 0 comments
Open

Override theme with auto import #2

rahulpatel033 opened this issue Mar 30, 2022 · 0 comments

Comments

@rahulpatel033
Copy link

Used two plugins to setup auto import, unplugin-auto-import, unplugin-vue-components
These are my configurations and scss files. The problem is i can't able to override the theme variables.

  1. webpack.config.js
//webpack.config.js
const path = require('path');
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')

module.exports = {
    resolve: {
        alias: {
            '@': path.resolve('resources/js'),
        },
    },
    plugins: [
        AutoImport({
          resolvers: [ElementPlusResolver()],
        }),
        Components({
          resolvers: [ElementPlusResolver()],
        }),
    ],
};
  1. app.scss (theme override)
//app.scss
// styles/element/index.scss
/* just override what you need */
@forward 'element-plus/theme-chalk/src/common/var.scss' with (
  $colors: (
    'primary': (
      'base': green,
    ),
  )
);
  1. webpack.mix.js
//webpack.mix.js
const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel applications. By default, we are compiling the CSS
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/js')
    .vue()
    .sass('resources/css/app.scss', 'public/css') // added the theme override css here
    .webpackConfig(require('./webpack.config'));

if (mix.inProduction()) {
    mix.version();
}
@rahulpatel033 rahulpatel033 changed the title Override themes with auto import. Override themes with auto import Mar 30, 2022
@rahulpatel033 rahulpatel033 changed the title Override themes with auto import Override theme with auto import Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant