teknql / shadow-cljs-tailwind-jit

Shadow build hooks for enabling JIT compilation of Tailwind CSS
95 stars 10 forks source link

Unexpected identifiers when reading existing js config files #9

Closed chrismurrph closed 3 years ago

chrismurrph commented 3 years ago

yarn shadow-cljs server yarn run v1.22.11

$ /home/chris/IdeaProjects/user-portal/node_modules/.bin/shadow-cljs server
shadow-cljs - config: /home/chris/IdeaProjects/user-portal/shadow-cljs.edn
shadow-cljs - HTTP server available at http://localhost:3000
shadow-cljs - server version: 2.12.5 running at http://localhost:9630
[:frontend] Using default value for :tailwind/config.
[:frontend] Using default value for :postcss/config.
[:frontend] Starting postcss process.
/home/chris/IdeaProjects/user-portal/tailwind.config.js:3
  darkMode: false,
  ^^^^^^^^

SyntaxError: Unexpected identifier

I got the same for purge:. This is when reading from file tailwind.config.js.

fnumatic commented 3 years ago

Can you post the full content of the tailwind.config.js? Which version of tailwind do you use?

Here is an example how to set the darkmode

// tailwind.config.js
module.exports = {
  darkMode: 'media',
  // ...
}
chrismurrph commented 3 years ago
module.exports = {
  mode: 'jit'
  purge: [],
  darkMode: false,
  theme: {
    fontFamily: {
      sans: ['Nunito Sans', 'sans-serif'],
      serif: ['Lora', 'serif']
    },
    extend: {
      colors: {
        'dark-navy': {
          '500': '#002838',
          '400': '#163343'
        },
        'annotation-orange': {
          '500': '#d77951'
        }
      },
      spacing: {
        '104': "28rem",
        '112': "32rem",
        '120': "36rem",
        '128': "40rem"
      }
    },
  },
  variants: {
    extend: {
      backgroundColor: ['active', 'checked'],
      borderColor: ['active', 'checked']
    },
  },
  plugins: [],
}
chrismurrph commented 3 years ago

As for which version of tailwind: "tailwindcss": "^2.2.7" from the package.json

fnumatic commented 3 years ago

the comma at line 2 mode: 'jit',

rschmukler commented 3 years ago

@chrismurrph I'm assuming that the above fixed this, can I close?

chrismurrph commented 3 years ago

Yes sure. Thanks for helping me.