I try to get an Electron app running with webpack, Vuejs and tailwindcss, starting with the electron-webpack template package and adding Vuejs and tailwindcss afterwards, but tailwindcss doesn't work.
There is this equivalent thread on SO, but the solution mentioned there uses electron-vue, which has over 200 open issues and doesn't seems to be maintained anymore.
Does anybody has an idea what went wrong here? I proceeded as follows:
Initialize Electron webback boilerplate (according to here):
git clone https://github.com/electron-userland/electron-webpack-quick-start.git project cd project rm -rf .gitInstall Vuejs:
yarn add --dev vue css-loader vue-loader vue-template-compilerSetting up webpack for Vuejs:
const { VueLoaderPlugin } = require("vue-loader"); module.exports = { module: { rules: [ { test: /\.vue$/, use: 'vue-loader' } ], plugins: [ new VueLoaderPlugin() ] } }Test Vuejs by modifying
src/renderer/index.jsto:'use strict'; import Vue from 'vue' import App from './App.vue' new Vue({ el: '#app', render(h) { return h(App) } })and adding
src/renderer/App.vue:<template> <div>Welcome</div> </template>→ Works so far.
Install tailwindcss:
yarn add —-dev tailwindcss postcss-loader autoprefixerAdd tailwindcss to project:
src/renderer/index.js:... import './assets/styles.css'; ...src/assets/styles.css:@tailwind base; @tailwind components; @tailwind utilities;
Include postcss-loader to webpack:
- Add
postcss.config.js:const autoprefixer = require('autoprefixer'); const tailwindcss = require('tailwindcss'); module.exports = { plugins: [ tailwindcss, autoprefixer, ], }; - Modify
webpack.config.js:... module.exports = { module: { rules: [ ..., { test: /\.css$/, use: [ 'vue-style-loader', { loader: 'css-loader', options: { importLoaders: 1 } }, 'postcss-loader' ] } ...
- Add
Test tailwindcss by modifying
App.vue:<template> <div class="bg-blue-100">Welcome</div> </template>→ Failed: Background of "Welcome" text should be blue, but isn't, text is still serif.