Hi,
I'm building a Nuxt library with Tailwind as a CSS framework and I'm trying to include some Syncfusion controls.
I saw in the Release note that the Tailwind CSS theme has been added. Is there an integration between Syncfusion components and Tailwind? What's the best approach?
In this CodeSandBox I tried to integrate them but I get an error when I import Syncfusion scss. I'm probably forgetting something in the nuxt.config.js...
Thank you in advance.
|
|
Hi Sevvandhi,
thanks but your answer has nothing to do with the questions I asked and it seems you didn't even look at the example I attached.
I showed you an example with Nuxt, Tailwind and Syncfusion controls, you instead answered me with one in Vue.js and Syncfusion controls.
My problem is that when i use the scss files as below i get the following error:
if you open my CodeSandBox and try to use css files everything works, with scss not.
I need to use scss files because I have to modify some variables.
Thanks.
Regards,
Marco
|
<style scoped lang="scss">
/* This is working */
/** This isn't working */
$primary: var(--primary-color);
/* @import "@syncfusion/ej2-base/styles/tailwind.scss";
@import "@syncfusion/ej2-vue-inputs/styles/tailwind.scss"; */
.e-contextmenu-wrapper .e-menu-parent {
color: var(--primary-color);
}
.e-contextmenu-wrapper ul .e-menu-item.e-focused {
color: var(--primary-color);
}
</style>
|
|
<style scoped lang="scss">
/* This is working */
/** This isn't working */
/* $primary: var(--primary-color);
*/
.e-contextmenu-wrapper .e-menu-parent {
color: var(--primary-color);
}
.e-contextmenu-wrapper ul .e-menu-item.e-focused {
color: var(--primary-color);
}
</style>
|
Marco, did you solve your problem? I had the same :(
The solution above from Sevvandhi N is not good for me, because in such way i should replace every selector with custom --primary-color variable
Need something like https://www.syncfusion.com/forums/143790/vue-scss , but for Nuxt.js
Hi Kirill,
you are lucky, I solved my problem just yesterday :)
The approach shown in your link is correct, you simply need to adapt it for Nuxt.
Add these lines in the build section of your nuxt.config.js:
And then in your component you can use scss files and work with variables:
Et voilà, thats it:
The only problem is that if you reference the style as scoped, the component doesn't render well.
Maybe Sevvandhi could help us...
Let me know if the solution works for you ;)
Thank u so much! That works! In my case i only remove sass from test pattern, cause of vuetify styles
config.module.rules.push({
test: /\.(scss)$/,
use: {
loader: 'sass-loader',
options: {
sassOptions: {
includePaths: ['./node_modules/@syncfusion'],
},
},
},
});
Hello, follow another better (maybe) solution, in nuxt.config.js add:
build: {
loaders: {
scss: { // or sass or both
sassOptions: {
includePaths: [resolve(__dirname, './node_modules/@syncfusion')]
}
}
}
},