Some TailwindCSS classes in a fresh Laravel install is not working - php

Some TailwindCSS classes that involve color (namely bg and border) are not working.
This is my very first Laravel project and I am not sure where the problem is. Somebody else started the project and I cloned the git repository. I am developing locally on a Ubuntu 22.04 desktop box with Apache2 -v 2.4.54 and php -v 8.0.20. I got Laravel working weeks ago and spent all my time getting data on screen. Now I am trying to beautify my pages. I did not know that you had to install TailwindCSS seperately from Laravel so I installed it yesterday. I installed npm and TailwindCSS via npm install -D tailwindcss postcss autoprefixer. Tailwind.config.js, webpack.mix.js and /resources/css/app.css were already a part of my git repo and appear to normal.
Question: If you already have the needed files, is 'npx tailwindcss init` necessary (my init fails with a yaml error)?
I think TailwindCSS is working some, but I am not entirely sure. I added bg classes to the man Laravel and it seems to totally skip the class any bg and border classes I add.
I did have have the color-adjust warning when I ran npm run dev, but was able to get rid of it by targeting the a specific autoprefixer version.
autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated
I added the bg-blue-500 class several places, but nothing seems to work. There are other tw classes that appear to be working.
Question: What would cause these classes to be totally ignored? Did I miss something in the install?

Don't use the welcome page as an example. It contains all the tailwind styles it needs locally (in the head) on the page. Experiment with one of the internal pages.

Related

Browsershot won't save or write my pdf -> For some reason Chrome did not write

Looking for brilliant mind to help me fix my problem. I have inherited a Laravel v5.3 project, and the project should be able to pass CV's from html to .pdf. They have been using spatie/browsershot for that task. But for some reason the package won't write the damn file.
I have been looking at the html passed to the function, and it all checks out. So I went to the guide on Github and put this line of code into the codefile as the only one left in the function.
Browsershot::html('<h1>Hello world!!</h1>')->save('example.pdf');
No matter what I do, I get this error message:
Spatie \ Browsershot \ Exceptions \ CouldNotTakeBrowsershot
For some reason Chrome did not write a file at `example.pdf`.
I have also tried giving an absolute path for Browsershot to save the file at. But no matter. I have looked up many different guides the past two weeks, but nothing seems to work atm. Puppeteer is also installed locally.
I'm running a Windows 10 machine btw, with latest updates, if that matters.
I had the same issue in a PHP project. Installing the puppeteer package worked for me.
npm install puppeteer

Create new docker container with composer 2.0 installed

I am very new to docker and laradock, but I am trying to figure out how to create a new container that comes with composer 2.0 (or latest) installed automatically? How do I tell Laradock that I want the latest composer upon build/creation of the container?
I have followed several tutorials and several posts about this type of situation...however, nothing has panned out. If I build the container, and start the workspace bash, it comes up with composer 1.10 every time. I can update it from within the container, but I would prefer to have it installed by default, when the container is created. Thanks in advance.
You have a few options. Two that spring to mind are:
You can use the RUN command in your docker file to run pretty much any commands
you like. So you could in theory install composer this way.
You can manually install composer and then build a new image. The new image will contain the composer install. You then push that to your repo of choice and use it as the base image in your dockerfile. This is quite common practice.

How to cache composer packges in Jenkins

I've got a Laravel project and simple pipeline in Jenkins which build Docker image from Dockerfile, pull code in it and execute composer install. Everything working fine so far, but installing composer packages takes a lot of time (like 6-7 minutes). I've tried to persist vendor directory somewhere, create symlink to it or something but nothing worked so far. I wonder if there is some better more official way to handle that? Anyone has some idea or experience in it? Or maybe some different CI tool?
Ok, I ended up with two solutions:
I mounted composer cache directory to some directory in host to speed up composer packages installing:
dockerfile {
filename 'Dockerfile'
args '-v $HOME/composer_cache:/.composer/cache'
}
There is (not so obvious, because Jenkins panel is little messy) option to disable workspace clean up before/after code checkout. One can delete those steps in pipeline configuration under "Branch Sources" section (with red X above those "Behaviours").

Codeception install problem - vendor/bin/codecept vendor not recognised as internal... windows10

When I download codeception with composer and run vendor/bin/codecept from project directory, it says vendor not recognized as internal or external program.
There is a folder inside vendor codeception/codeception/codecept bootstrap and it works if I run it from in there but when creating a class test and running the tests I get weird results like isAngularTest....??
I have tried quite a few different commands but cant get it to work they way the codeception website indicates or how my lecture says it should. I am using windows 10.
You need to run vendor\bin\codecept.bat and not vendor\bin\codecept - the latter one is a Bash script, it won't start in Windows command line.
I am not sure why you tagged this question with PhpStorm, so I'll put this here just in case.

How to Deploy a Cake PHP App

I wonder if someone can help me. I've been handed in a Cake PHP app that I need to 1) add minor changes 2) deploy. I've never really worked with Cake before and was wondering whether do I need to anything in order for it to work?
For instance, With a Node app, you need to install modules npm install. With a Rails app you'll likely need to install the gems bundle install.
Is there something similar with Cake? I've set the localhost server, but when I try to access the url I get all sort of errors. Some I've fixed (missing environment settings which I just override the Redis host and port). The latest one is:
{
"exception":{
"class":"MissingControllerException",
"code":404,
"message":"Controller class Controller could not be found.",
"file":"\/Library\/WebServer\/Documents\/php\/oompbe\/vendors\/cakephp\/lib\/Cake\/Routing\/Dispatcher.php",
"line":154,
"trace":[
"#0 \.../app\/webroot\/index.php(109): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))",
"#1 {main}"
]
}
}
PS: What's up with all the crazy \/\/?
PPS: Can I find out the version Cake I'm running?
CakePHP is just php. As most properly done php apps these days it comes with composer. I recommend you to read at least the basics of it's manual. Composer is an awesome tool.
git clone <repo>
cd <reponame>
composer install
If you start a new Cake application the official documentation tells you how to this as well:
composer create-project --prefer-dist cakephp/app [app_name]
If you want to automate things further composer provides you callback scripts. They'll allow you to automate tasks, basically trigger commands, after different actions. This is pretty useful to build assets after a composer update for example. I recommend you to not put lots of commands into that section but instead have dedicated script files you trigger by the callbacks.
Can I find out the version Cake I'm running?
If installed via composer it is usually in vendor/cakephp/cakephp/version.txt. Check the content of that file.

Categories