We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Vue + SCSS

Thread ID:

Created:

Updated:

Platform:

Replies:

143790 Apr 4,2019 07:34 PM UTC Apr 5,2019 12:13 PM UTC Vue 3
loading
Tags: General
Oleg
Asked On April 4, 2019 07:35 PM UTC

Hi
I'm using npm and looking how I can add SCSS of the specific modules in my project?
I need grid and calendar SCSS
Example:
@import "./node_modules/@syncfusion/ej2-base/styles/material.scss";
@import "./node_modules/@syncfusion/ej2-buttons/styles/button/material.scss";
returns
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
@import 'ej2-base/styles/material-definition.scss';
^
File to import not found or unreadable: ej2-base/styles/material-definition.scss.
So - the system see no ej2-base/styles/ path

What will be the right syntax to have grid and calendar (buttons,dialogs, etc) works?

 need SCSS - because I have to use variables based on selected theme - css is not the option

please advise

Mydeen S N [Syncfusion]
Replied On April 5, 2019 12:03 PM UTC

 
Hi Oleg, 
 
Greetings from Syncfusion support. 

We suspect that the issue in the scss compilation is due to  not setting  the includePaths option in the webpack.config.js . We suggest you to configure the includePaths option in the vue-loader  settings in the webpack.config.js file to resolve the issue as mentioned in the below code snippet. 
 
 
module: {  
        rules: [  
            ....  
            ....  
            {  
                test: /\.vue$/,  
                loader: 'vue-loader',  
                options: {  
                    loaders: {  
                        // Since sass-loader (weirdly) has SCSS as its default parse mode, we map  
                        // the "scss" and "sass" values for the lang attribute to the right configs here.  
                        // other preprocessors should work out of the box, no loader config like this necessary.  
                        'scss': [  
                            'vue-style-loader',  
                            'css-loader',  
                            {  
                                loader: "sass-loader",  
                                options: {  
                                    includePaths: [  
                                        path.resolve(__dirname,"./node_modules/@syncfusion")  
                                    ]  
                                }  
                            }  
                        ]  
                        ....  
                        ....  
                    }  
                }  
            }  
            ....  
            ....              
        ]  
}  
  
 
  
And now, we can add the SCSS file reference directly in the App.vue file using below code snippet.  
 
  
For your convenience, we have created a simple sample and the same can be download from the below link.  


You can refer the below documentation for theme variables which you can used to customize the theme.  

Please find the example code snippet for overriding the accent color for our components in material theme. 

<style lang="scss"> 
// for example, we have override our variable color here 
$accent: black; 
// syncfusion styles 

</style> 

 

Let us know if you need further assistance on this. 

Regards, 
Mydeen SN 
 


Oleg
Replied On April 5, 2019 12:09 PM UTC

Great! Thank you! this is exactly what I was looking for!!!!

Mydeen S N [Syncfusion]
Replied On April 5, 2019 12:13 PM UTC

Hi Oleg, 
We are happy that the problem has been solved. 
  
Please get back to us if you need any further assistance. 
  
Regards, 
Mydeen S N 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon