fivem icon indicating copy to clipboard operation
fivem copied to clipboard

Update FiveM CEF to support tailwind v4

Open kratess opened this issue 8 months ago • 14 comments

What happened?

Tailwind v4 introduced OKLCH color codes. OKLCH is not yet supported by the current version of cef chromium running on FiveM.

Expected result

Run OKLCH colors

Reproduction steps

Use tailwind4 colors.

Importancy

Slight inconvenience

Area(s)

FiveM

Specific version(s)

FiveM all versions

Additional information

No response

kratess avatar Apr 03 '25 17:04 kratess

Not gonna happen.

coblyox avatar Apr 03 '25 18:04 coblyox

An update to a newer CEF build is still planned and, based on public GitHub logs, is actively in progress.

tens0rfl0w avatar Apr 03 '25 19:04 tens0rfl0w

An update to a newer CEF build is still planned and, based on public GitHub logs, is actively in progress.

Finally, because before team said, I quote:

We don't plan to update CEF currently. Whole NUI thing is a big mess, so it will not worth it

coblyox avatar Apr 03 '25 19:04 coblyox

If that‘s the response you received then this of course holds more value to it than any code activity one might observe. I just based my comment on: https://github.com/citizenfx/cef/tree/cfx-m130 and recent work on the associated build scripts. Might be no indication for a planned update then.

tens0rfl0w avatar Apr 03 '25 19:04 tens0rfl0w

I'm not sure if there is someone interested in that part to transfer the changes on the CEF side.

ayazwai avatar Apr 04 '25 11:04 ayazwai

One thing I have found out is that you can polyfill your css for things like tailwind v4 with postcss-preset-env. It's a postcss plugin that will run at build time and fill in rgb fallbacks to your oklch colors. I run it as a vite postcss plugin with no config and it seems to do the job. I have not tested it extensively so i am not sure what might still be broken... maybe some VERY new css features that tailwind might use.

RussianRonin avatar Apr 07 '25 20:04 RussianRonin

...

We don't plan to update CEF currently. Whole NUI thing is a big mess, so it will not worth it

What does that have to do with CEF? NUI and CEF are entirely different things, you can update the underlying CEF without touching NUI code.

One thing I have found out is that you can polyfill your css for things like tailwind v4 with postcss-preset-env. It's a postcss plugin that will run at build time and fill in rgb fallbacks to your oklch colors. I run it as a vite postcss plugin with no config and it seems to do the job. I have not tested it extensively so i am not sure what might still be broken... maybe some VERY new css features that tailwind might use.

Easiest way is to just go and check 3.x version theme files and extend your tailwindcss config with the old rgb values so they're overwritten. Takes 5 seconds at most to copy over content into your config file.

TimFL avatar Apr 08 '25 11:04 TimFL

@RussianRonin

Image

postcss-preset-env does not override well tailwind v4 css.

css: { postcss: { plugins: [postcssPresetEnv({ features: {} })] } },

Am I doing something wrong?

kratess avatar Apr 14 '25 22:04 kratess

@RussianRonin

Image

postcss-preset-env does not override well tailwind v4 css.

css: { postcss: { plugins: [postcssPresetEnv({ features: {} })] } },

Am I doing something wrong?

Not trying to provide support but it looks like you are overriding the features with nothing so it isn't doing anything possibly. This is my vite config:

  css: {
    postcss: {
      plugins: [
        postcssPresetEnv
      ]
    }
  }

RussianRonin avatar Apr 17 '25 02:04 RussianRonin

Any update on this?

ESK0 avatar Jun 28 '25 12:06 ESK0

Looking for an update on this, since it still doesn't work

PatalJunior avatar Oct 03 '25 23:10 PatalJunior

I leave here my config that worked with postcss as said above.

vite.config.js

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { fileURLToPath } from 'url';
import path from 'path';
import postcssPresetEnv from 'postcss-preset-env';
import tailwindcss from '@tailwindcss/postcss';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);


export default defineConfig({
  plugins: [react()],
  base: './',
  css: {
    postcss: {
      plugins: [
        postcssPresetEnv({}),
        tailwindcss({}),
      ]
    }
  },
  build: {
    outDir: '../build',
    emptyOutDir: true,
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
      '@components': path.resolve(__dirname, './src/components'),
      '@utilities': path.resolve(__dirname, './src/utilities'),
    },
  },
});

PatalJunior avatar Oct 04 '25 00:10 PatalJunior

Without any configuration, postcss-preset-env won't magically make it happen for you. The query should be adjusted to support the Chrome version being used in FiveM.

export default {
    plugins: {
        '@tailwindcss/postcss': {},
        'postcss-preset-env': {
            stage: 2,
            browserslist: '> 0.2% and not dead and Chrome >= 103',
        },
    },
};

duydang2311 avatar Oct 15 '25 11:10 duydang2311