question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Empty values for variables

See original GitHub issue

Tailwind version: 3.0.15

Hi. I installed a fresh project on Laravel 8 and after configuring it, I noticed that it is full of empty values. Everything else works as expected.

generated CSS:

--tw-scale-y: 1;
  --tw-pan-x:  ;
  --tw-pan-y:  ;
  --tw-pinch-zoom:  ;
  --tw-scroll-snap-strictness: proximity;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
...

My config: postcss.config.js

module.exports = {
    plugins: [
        require('postcss-import'),
        require('tailwindcss/nesting'),
        require('tailwindcss'),
        require('autoprefixer'),
    ]
}

tailwind.config.js

module.exports = {
    content: [
        './storage/framework/views/*.php',
        './resources/**/*.blade.php',
        './resources/**/*.js',
        './resources/**/*.vue',
    ],
    darkMode: 'media', // or 'media' or 'class'
    theme: {
        fontFamily: {
            sans: ['Verdana', 'Arial', 'Helvetica', 'sans-serif'],
            serif: ['serif'],
        },
        extend: {},
    },
    variants: {
        extend: {},
    },
    plugins: [],
    corePlugins: {
        preflight: true,
    },
}

webpack.mix.js

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css')
    .options({
        processCssUrls: false,
    });

app.css

@tailwind base;
@tailwind components;
@tailwind utilities;

obraz

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
RobinMalfaitcommented, Jan 19, 2022

Yep, it was var(--tw-empty,/*!*/ /*!*/); before because minifiers incorrectly minified var(--tw-empty, ) as var(--tw-empty,) (notice the space) which makes it invalid. So we applied this hack to make as many minifiers as possible empty. What you will notice is that there is still a space between the two /*!*/. The reason we have a ! in there is because normal comments are removed by minifiers.

Long story short, --tw-blur: var(--tw-empty,/*!*/ /*!*/); is a fancy/over-complex version of --tw-blur: ;

2reactions
RobinMalfaitcommented, Jan 19, 2022

Hey! Thank you for your question! Much appreciated! 🙏

This is by design and not a bug. It is a bug in your IDE for incorrectly thinking that it is a bug.

These empty values are defaults and we use them in different places. If we don’t have them and you use one of those variables then the variable is “undefined” and the css would be broken.

We have some utilities that override these values so that they actually do something. For example try to use “rotate-45” and look at the generated css.

If you build your css then you should see that everything should work as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Define Empty Variables and Data Structures in Python
Defining empty variables in Python is straightforward. If you wish to define a placeholder for a missing value that will not be used...
Read more >
empty - Manual - PHP
Determine whether a variable is considered to be empty. A variable is considered empty if it does not exist or if its value...
Read more >
what is the purpose of setting variables to empty (" ") after ...
It means to initiate all the variables to empty value. So when you try to access those variables you don't get undefined variable...
Read more >
The Null Variable - Using IDL - L3HarrisGeospatial.com
The system variable !NULL is a special variable of type Undefined. Unlike a variable that is truly undefined, the value !NULL can be...
Read more >
Variables with null value - Nintex help documentation
A variable with null value is empty and has no value. When a connector supports null values, you may need to set the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found