Modify sass-loader options in webpack.mix.js file
See original GitHub issueHave any option to modify the sass-loader options in the webpack.mix.js file? I want to import (override) sass variables into my .vue file <style> tags.
For example:
Example.vue:
<template> ... </template>
<script> export default { ... } </script>
<style lang="scss">
/* ---- I want to import ./styles/custom_variables file here ---- */
@import './styles/imports';
$ui-alert-color : rgba(black, 0.75) !default;
$ui-alert-font-size : rem-calc(15px) !default;
$ui-alert-margin-bottom : rem-calc(16px) !default;
</style>
I can modify the webpack.config.js#L165 to:
options:
Object.assign(
toCompile.pluginOptions,
{ data: '@import "./styles/custom_variables";' }
)
But i think it’s not a nice workaround.
Ps: It’s an awesome tool Jeff, keep it up! 😃
Issue Analytics
- State:
- Created 7 years ago
- Comments:11
Top Results From Across the Web
Modify sass-loader options in webpack.mix.js file #411 - GitHub
Have any option to modify the sass-loader options in the webpack.mix.js file? I want to import (override) sass variables into my .vue file....
Read more >Sass Preprocessing | Laravel Mix Documentation
Let's add Sass compilation to our webpack.mix.js file. ... For a full list of supported options, please refer to the webpack documentation for...
Read more >sass-loader - webpack - JS.ORG
Loads a Sass/SCSS file and compiles it to CSS. ... Then add the loader to your Webpack configuration. For example: app.js import "./style.scss";....
Read more >vue.js - Sass Loader issue with Webpack and Laravel Mix 3
I have a project that is using Laravel Mix version 3 (I cannot upgrade because of the known dynamic importing issue with Webpack...
Read more >Compiling Assets (Mix) - The PHP Framework For Web Artisans
js file is your entry point for all asset compilation. Think of it as a light configuration wrapper around webpack. Mix tasks can...
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
You can pass your plugin options as the third argument to
mix.sass()
. So I think you should be able to do:That doesn’t work for me. The
@import
from thedata
option only gets applied to the mainapp.scss
file im processing. Not to the*.vue
components imported in the JS.