Skip to content

[Feature Request] How can i change path for sass override on webpack installation? #300

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

Closed
selimdoyranli opened this issue Nov 19, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@selimdoyranli
Copy link

Problem to solve

I can override sass when created in a variables.scss /src/sass.

How can i change default /src/sass/variables.scss to /src/assets/style/scss/variables/_vuetify-override.scss

my vue.config.js

/* eslint-disable no-param-reassign */
const path = require('path');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const CKEditorWebpackPlugin = require('@ckeditor/ckeditor5-dev-webpack-plugin');
const { styles } = require('@ckeditor/ckeditor5-dev-utils');

module.exports = {
  css: {
    extract: { ignoreOrder: true },
  },
  configureWebpack: config => {
    config.resolve.alias['@'] = path.resolve(__dirname, 'src/');
    config.resolve.alias.piri = path.resolve(__dirname, 'src/piri');

    config.plugins.push(new StyleLintPlugin({
      files: ['{assets/style,src}/**/*.{css,sass,scss,less,stylus,vue}'],
    }));

    const ckEditorWebpackPlugin = new CKEditorWebpackPlugin({
      language: 'tr',
    });

    config.plugins.push(ckEditorWebpackPlugin);
  },
  transpileDependencies: [/ckeditor5-[^/\\]+[/\\]src[/\\].+\.js$/, 'vuetify'],
  chainWebpack: config => {
    const oneOfsMap = config.module.rule('scss').oneOfs.store;
    oneOfsMap.forEach(item => {
      item
        .use('sass-resources-loader')
        .loader('sass-resources-loader')
        .options({
          // Global Styles (Do not import actual styles)
          resources: [
            // Plugins
            './src/assets/style/scss/plugins/_browserhack.scss', // Doc: https://github.com/selimdoyranli/browser-hack-sass-mixins
            './src/assets/style/scss/plugins/_breakpoint.scss',
            './src/assets/style/scss/plugins/_mq.scss', // Doc: https://github.com/sass-mq/sass-mq
            // Functions
            './src/assets/style/scss/functions/_center.scss',
            './src/assets/style/scss/functions/_triangle.scss',
            // Mixins
            './src/assets/style/scss/mixins/_font.scss',
            './src/assets/style/scss/mixins/_gradient.scss',
          ],
        });
    });

    config.module
      .rule('pug')
      .test(/\.pug$/)

    // this applies to <template lang="pug"> in Vue components
      .oneOf('vue-loader')
      .resourceQuery(/^\?vue/)
      .use('pug-plain')
      .loader('pug-plain-loader')
      .end()
      .end()

    // this applies to pug imports inside JavaScript, i.e. .pug files
      .oneOf('raw-pug-files')
      .use('pug-raw')
      .loader('raw-loader')
      .end()
      .use('pug-plain')
      .loader('pug-plain-loader')
      .end()
      .end();

    const svgRule = config.module.rule('svg');
    svgRule.exclude.add(path.join(__dirname, 'node_modules', '@ckeditor'));
    svgRule.exclude.add(
      path.join(__dirname, 'src', 'components', 'misc', 'form', 'html-editor', 'CKEditor', 'plugins'),
    );

    config.module
      .rule('cke-svg')
      .test(/ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/)
      .use('raw-loader')
      .loader('raw-loader');

    config.module
      .rule('cke-css')
      .test(/ckeditor5-[^/\\]+[/\\].+\.css$/)
      .use('postcss-loader')
      .loader('postcss-loader')
      .tap(() => styles.getPostCssConfig({
        themeImporter: {
          themePath: require.resolve('@ckeditor/ckeditor5-theme-lark'),
        },
        minify: true,
      }));

    config.module
      .rule('graphql')
      .test(/\.graphql$/)
      .use('graphql-tag/loader')
      .loader('graphql-tag/loader')
      .end();
  },
  pluginOptions: {
    apollo: {
      lintGQL: true,
    },
  },
};

Proposed solution

--

@KaelWD KaelWD transferred this issue from vuetifyjs/vuetify Oct 5, 2021
@KaelWD
Copy link
Member

KaelWD commented Oct 5, 2021

Duplicate of #187

@KaelWD KaelWD marked this as a duplicate of #187 Oct 5, 2021
@KaelWD KaelWD closed this as completed Oct 5, 2021
@KaelWD KaelWD added the duplicate This issue or pull request already exists label Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants