Electron-vue: Using Tailwind-css

Created on 1 Dec 2018  ·  6Comments  ·  Source: SimulatedGREG/electron-vue

Hi is there a way to use tailwind-css within the electron-vue, I've followed the docs but i doesn't seem to work

Most helpful comment

Yes i did
first open .electron-vue/webpack.renderer.config.js and add postcss-loader like this

{
module: {
  rules: [
    //...
    test: /\.css$/,
    use: ['vue-style-loader', 'css-loader', 'postcss-loader']
 },

then install it yarn add -D postcss-loader

Now create postcss.config.js in the root of the project
write inside it
`php module.exports = { plugins: [ require("tailwindcss")("./tailwind.js"), require("autoprefixer")(), ] };

this should solve the problem

All 6 comments

Did You find a solution for this? I'm struggling myself.

Yes i did
first open .electron-vue/webpack.renderer.config.js and add postcss-loader like this

{
module: {
  rules: [
    //...
    test: /\.css$/,
    use: ['vue-style-loader', 'css-loader', 'postcss-loader']
 },

then install it yarn add -D postcss-loader

Now create postcss.config.js in the root of the project
write inside it
`php module.exports = { plugins: [ require("tailwindcss")("./tailwind.js"), require("autoprefixer")(), ] };

this should solve the problem

Guys did you ever get @apply functions to work? I managed to get the inline styles working but not @apply to build my own styles

@ciarans Have you been able to solve the @apply functions? I can't get them to work.

For anyone reading this in the future the info above helped me to get Tailwind working on Electron Vue, but you also need to do the following:

Create a tailwind.css file with the following code in it.

@tailwind base;
@tailwind components;
@tailwind utilities;

Import that into your main.js Vue script (not the App.vue)

import './assets/css/tailwind.css'

@MiloudiMohamed thanks, that worked!

I didn't need to run yarn add -D postcss-loader as it is a dependency of vue-loader.

Was this page helpful?
0 / 5 - 0 ratings