Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind CSS styles not globally accessible #23

Closed
miketromba opened this issue Aug 2, 2019 · 4 comments
Closed

Tailwind CSS styles not globally accessible #23

miketromba opened this issue Aug 2, 2019 · 4 comments

Comments

@miketromba
Copy link

miketromba commented Aug 2, 2019

ISSUE: Tailwind CSS styles not globally accessible

I installed this plugin via the nuxt-create-app CLI.
When trying to use tailwind classes within my .vue files, the styles are not being applied.

The tailwind.css file is located inside: assets/css/tailwind.css
I did not touch the contents:

@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

I read through the docs multiple times, but I can't figure out what's wrong...

Here are my package.json dependencies:

  "dependencies": {
    "cross-env": "^5.2.0",
    "express": "^4.16.4",
    "@nuxtjs/axios": "^5.3.6",
    "@nuxtjs/pwa": "^2.6.0",
    "nuxt": "^2.0.0"
  },
  "devDependencies": {
    "@nuxtjs/tailwindcss": "^1.0.0",
    "nodemon": "^1.18.9"
  }

Here is my nuxt.config.js:

module.exports = {
  mode: 'universal',
  /*
  ** Headers of the page
  */
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
      // { rel: 'stylesheet', href: '/css/tailwind.css' },
      // { rel: 'stylesheet', href: '/css/main.css' },
    ]
  },
  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },
  /*
  ** Global CSS
  */
  css: [
      '@/assets/css/main.css'
  ],
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
  ],
  /*
  ** Nuxt.js dev-modules
  */
  devModules: [
    // Doc: https://github.com/nuxt-community/nuxt-tailwindcss
    '@nuxtjs/tailwindcss',
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
    '@nuxtjs/pwa',
  ],
  /*
  ** Axios module configuration
  ** See https://axios.nuxtjs.org/options
  */
  axios: {
  },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {
    }
  }
}

Thanks in advance.

@miketromba
Copy link
Author

miketromba commented Aug 2, 2019

I found a workaround by adding to the build option of nuxt.config.js:
I think this signals that postcss is not using the tailwindcss plugin by default on install.

The README instructions for this repo don't mention that this is required...


    build: {
        /*
        ** You can extend webpack config here
        */
        extend(config, ctx) {
        },
        postcss: {
            // Add plugin names as key and arguments as value
            // Install them before as dependencies with npm or yarn
            plugins: {
                // Disable a plugin by passing false as value
                'tailwindcss': {}
            },
        }
    }

@Atinux
Copy link
Collaborator

Atinux commented Aug 7, 2019

This is weird since it's added here: https://github.com/nuxt-community/nuxt-tailwindcss/blob/master/lib/module.js#L39

Are you using Nuxt.js with another framework (express.js, koa, etc?)

@miketromba
Copy link
Author

miketromba commented Aug 7, 2019

@Atinux - I’m using express.js (as installed by nuxt-create-app CLI)

I’m away now but will try to dig into this more when I get home later this week

(Thanks for bringing us nuxt!!)

@Atinux
Copy link
Collaborator

Atinux commented Aug 8, 2019

Hi @Govern0r

You can upgrade to v1.1.2, I fixed the issue (and tested on an Express.js example)

(Thank you for kind words 😊 )

@Atinux Atinux closed this as completed Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants