Code Monkey home page Code Monkey logo

Comments (19)

epegzz avatar epegzz commented on July 23, 2024 2

Is it possible you can do this this year? ;)

oh yeah, absolutely 👍

from sass-vars-loader.

epegzz avatar epegzz commented on July 23, 2024 2

@dschox file order is now respected in v6.0.0. Thanks for your patience 👍

from sass-vars-loader.

epegzz avatar epegzz commented on July 23, 2024 1

Hm, this would actually not work, since the sass files always come first. That's a stupid design! 🙈 😆

CleanShot 2019-08-23 at 13 45 55@2x

I could change that. It's basically #23

from sass-vars-loader.

dschox avatar dschox commented on July 23, 2024 1

@epegzz I think a PR is out of my league :)
Is it possible you can do this this year? ;)

from sass-vars-loader.

dschox avatar dschox commented on July 23, 2024 1

@epegzz Any news on this? :)

from sass-vars-loader.

epegzz avatar epegzz commented on July 23, 2024 1

The year is not over yet! 😆

from sass-vars-loader.

epegzz avatar epegzz commented on July 23, 2024

So what you're basically saying is, that the @import '~@/assets/styles/...' is not working?

from sass-vars-loader.

epegzz avatar epegzz commented on July 23, 2024

Ah, no, the imports are working, but the files don't see the vars from the sass-vars-loader, right?

from sass-vars-loader.

netstuff avatar netstuff commented on July 23, 2024

Thank you for reply, @epegzz!

Ah, no, the imports are working, but the files don't see the vars from the sass-vars-loader, right?

Yes, it is! I think there is inproper loading order. But I am not sure.

from sass-vars-loader.

epegzz avatar epegzz commented on July 23, 2024

Basically what the sass-vars-loader is doing, is converting this:

@import '~@/assets/styles/vars';
@import '~@/assets/styles/util';
@import '~@/assets/styles/func';
@import '~@/assets/styles/mixins';
@import '~@/assets/styles/colors';

to this:

$var1=value1
$var2=value2
...
@import '~@/assets/styles/vars';
@import '~@/assets/styles/util';
@import '~@/assets/styles/func';
@import '~@/assets/styles/mixins';
@import '~@/assets/styles/colors';

So, as far as I understand Sass, the code in the @imported files should have access to those global vars 🤔

from sass-vars-loader.

epegzz avatar epegzz commented on July 23, 2024

I'm not really familiar with the chainWebpack method. Could it be that the css command is actually overwriting the results from sass-vars-loader?

from sass-vars-loader.

epegzz avatar epegzz commented on July 23, 2024

What about putting the @imports in a .sass file and load it as part of the sass-vars-loader?

const path = require('path');

module.exports = {
  chainWebpack: (config) => {
    const moduleTypes = ['vue-modules', 'vue', 'normal-modules', 'normal'];
    moduleTypes.forEach(moduleType =>
      config.module
        .rule('scss')
        .oneOf(moduleType)
        .use('@epegzz/sass-vars-loader')
        .loader('@epegzz/sass-vars-loader')
        .options({
          syntax: 'scss',
          files: [
            path.resolve(__dirname, 'src/assets/styles/contracts/variables.json'),
            path.resolve(__dirname, 'src/assets/styles/contracts/icons.json'),
            path.resolve(__dirname, 'src/assets/styles/imports.scss') // <--- 
          ],
        })
    )
  }
}

from sass-vars-loader.

netstuff avatar netstuff commented on July 23, 2024

What about putting the @imports in a .sass file and load it as part of the sass-vars-loader?

I have tried it and have got error while parsing .scss-file :(

from sass-vars-loader.

dschox avatar dschox commented on July 23, 2024

Could you please implement this? #23
I'm in the same boat. Changing the order manually inside node_modules works for me.
Thank You! :)

from sass-vars-loader.

epegzz avatar epegzz commented on July 23, 2024

@dschox unfortunately I'm really busy lately and won't have the time to work on this currently. But I'm happy to merge any incoming PR :)

from sass-vars-loader.

dschox avatar dschox commented on July 23, 2024

Thank You very much! And happy new year :)

from sass-vars-loader.

franciscolourenco avatar franciscolourenco commented on July 23, 2024

@epegzz I ran into the same issue and this works around the problem, thanks! 👍

from sass-vars-loader.

dschox avatar dschox commented on July 23, 2024

I think we can close this...

from sass-vars-loader.

franciscolourenco avatar franciscolourenco commented on July 23, 2024

Maybe a mention in the README to the alternative data/prependData option.

from sass-vars-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.