Coder Social home page Coder Social logo

Comments (11)

chrisvfritz avatar chrisvfritz commented on July 3, 2024

@zjhiphop Check out the docs for sass-loader. You'll need to add a loader for SCSS to use SCSS in their own files, outside of components. The only difference is that instead of the style loader, you'll use vue-style. Let me know how that works out for you. 😃

from webpack.

chrisvfritz avatar chrisvfritz commented on July 3, 2024

@zjhiphop Just checking in. Have you had a chance to see if the suggestion above worked for you?

from webpack.

chrispappas avatar chrispappas commented on July 3, 2024

I am trying to do this literally right now - saw your last comment pop up in real time!

If you can help with an example snippet that would be helpful. I'm trying to do:

require('src/assets/scss/main.scss')

inside my App.vue component

from webpack.

chrispappas avatar chrispappas commented on July 3, 2024

I actually might be on the right track here already, added the following to my webpack.base.conf.js file in the loaders array (although getting other unrelated errors so I can't quite confirm):

      {
        test: /\.scss$/,
        loaders: ["css", "sass"]
      },

from webpack.

chrisvfritz avatar chrisvfritz commented on July 3, 2024

@chrispappas Almost. I believe this would be what you want:

{
  test: /\.scss$/,
  loaders: [ 'vue-style', 'css', 'sass' ]
}

from webpack.

chrispappas avatar chrispappas commented on July 3, 2024

Nice, I had actually added the stock style-loader and prepended style to the loaders array, which seems to work great. Should I replace it with vuejs/vue-style-loader instead? This seems to work just fine for my purposes at this point with the stock style-loader plugin.

from webpack.

chrisvfritz avatar chrisvfritz commented on July 3, 2024

@yyx990803 forked style-loader to fix some issues with it. I don't know a lot about that - I've just always used vue-style-loader and never had issues. 😃 Evan will be able to better explain the history behind that decision and whether it matters for you in this case.

from webpack.

yyx990803 avatar yyx990803 commented on July 3, 2024

I forked it to provide better source map support for injected style tags during development, but other than that they are largely the same.

from webpack.

chrispappas avatar chrispappas commented on July 3, 2024

Thanks for the help guys, much appreciated.

from webpack.

chrisvfritz avatar chrisvfritz commented on July 3, 2024

@chrispappas Excellent. Even though this is resolved, I want to keep the issue open for now. I'm considering implementing something similar to this, so that CSS preprocessor files just automatically work if the loader is installed, similar to how they do in components.

from webpack.

chrisvfritz avatar chrisvfritz commented on July 3, 2024

Resolved in #84.

from webpack.

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.