Using SCSS in Vue components
See original GitHub issueI’m looking for a way to tell laravel-mix
to use the sass-loader
when it comes across the following in a Vue component.
<style lang="scss">
// random scss
</style>
The issue at hand is that there isn’t really an scss-loader
. sass-loader
is used for both scss
and sass
, however by default whenever vue-loader
sees lang="scss"
it tries to find scss-loader
.
I could just use lang="sass"
, however this causes most text editors to highlight (would-be) sass
errors.
When using laravel-elixir
I’m able to get around this by adding the following snippet to my webpack.config.js
file.
module.exports = {
vue: {
loaders: {
js: 'buble-loader',
scss: 'vue-style-loader!css-loader!sass-loader'
}
}
}
I’m currently using the mix.webpackConfig
method to change other configuration, however I’m not sure what options I need to pass in to accomplish my goals.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to use SCSS with Vue.js Single File Components
Find out how to enable SCSS into your Vue.js components.
Read more >Using Pre-Processors - Vue Loader - Vue.js
It will automatically infer the proper loaders to use based on the lang attribute of a language block and the rules in your...
Read more >Automatically import SASS/SCSS into every Vue.js component
The good news is that the Vue CLI makes it incredibly easy to support writing SCSS, and with Vue's single file components you...
Read more >Today I Learned: Using SCSS in your Vue Components
Styling your Vue components with SCSS is incredibly simple – provided you have the right configuration. const VueLoaderPlugin = require('vue- ...
Read more >Globally Load SASS into your Vue.js Applications
Loading global SASS in the vue-cli ... Vue-cli allows to modify its configuration by creating a vue.config.js file at the root of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey guys, I’ve updated the
webpack.config.js
to allow for specifying:Or:
6 months later, someone walks by and wonders the same thing a @laaksomavrick
Is it ok to import bootstrap scss in every styled component, or is that duplicating a whole bunch of css that ends up in the bundle?! Thank you!