Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How do I use tailwindcss @apply directive inside a svelte component

$
0
0

This works:

<div class="list p-2" />

This doesn't work:

<style lang="postcss">  @tailwind base;  @tailwind components;  @tailwind utilities;  @layer components {    .list {      @apply p-2;    }  }</style>

I looked in Svelte's docs, but it explains the process with SvelteKit, which I'm not using. How can I make it work?

webpack.config.js:

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

tailwind.config.js:

module.exports = {  purge: ['./*.html','./src/**/*.js','./src/**/*.svelte'  ],  darkMode: false, // or 'media' or 'class'  theme: {    extend: {},  },  variants: {    extend: {},  },  plugins: [],}

postcss.config.js:

module.exports = {  plugins: [    ['tailwindcss'],    ['autoprefixer'],  ],};

Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>