I am using Symfony + Vue.js, and I would like to import my _variables.sccs file in all the vue components. I want to use the scss variables in the style blocks of all of my components
I know how to do it in a vue app created with vue-cli (using vue.config.js config file), but i've tried to replicate this in different ways in the webpack.config.js used by Encore... and there is no way to make it work.
This is my webpack.config.js file:
var Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.addEntry('app', './assets/js/app/app.js')
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
// enables @babel/preset-env polyfills
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = 3;
})
// enables Sass/SCSS support
.enableSassLoader()
// enable Vue.js
.enableVueLoader()
.configureWatchOptions(function (watchOptions) {
watchOptions.poll = 250;
})
;
module.exports = Encore.getWebpackConfig();
Any idea?