2👍
✅
You can require tailwind’s package.json and get the version from there.
//app.js
require('./bootstrap');
const tailwindCssVersion = require('tailwindcss/package.json').version;
import { createApp } from 'vue'
import { version } from 'vue'
let app = createApp({
data() {
return {
vueVersion: version,
tailwindCssVersion: tailwindCssVersion
}
},
}).mount('#app')
<h4 class="text-sm mt-4">[...] TailwindCSS v${ tailwindCssVersion }</h4>
👤IGP
2👍
You can use php file_ge_content to read package.json
<?php
$packageJSON = json_decode( file_get_contents(ABSPATH . 'package.json') );
var_dump($packageJSON->devDependencies->tailwindcss);
0👍
<?php
$packageJSON = json_decode(file_get_contents(base_path() . '/package.json'));
$tailwindV = $packageJSON->devDependencies->tailwindcss;
$out = str_replace('^', '', $tailwindV); //add this line if you want remove ^ sign
echo $out;
?>
Source:stackexchange.com