CSS Cache Laravel - php

I have a site under Laravel based on a template uploaded on Themeforest. I use the CSS proposed by this template. I would like to set up custom CSS rules but I have the impression that Laravel has a cache. No CSS changes are displayed. I have the problem in two cases: if I make a new CSS file or even if I modify an existing CSS file.
I tried to clear my browser's cache.
I tried to clear Laravel's cache with artisan views:clear and artisan cache:clear.
I also checked that my CSS files were included in my Blade file.
This is strange because if I put CSS directives directly into my Blade file as HTML (style=""") it works. But once it's in an external file it doesn't work.
Do you have any leads ?

Please try this code for the bootstrap cache clear.
php artisan cache:clear
php artisan config:cache
or
php artisan optomize

Related

Laravel: how to cache config files properly

I'm using Laravel 8.0 in my application and I added a new .env variable:
APP_URL_FRONT=https://tmsv00008:6204
And how I use it:
To access the project use the following link: LINK
When I deploy the application I cache the config files:
php artisan config:cache
But the env files is not visible and the strange thing is that if I execute:
php artisan config:clear
The variable is visible.
What I'm doing wrong? Because it doesn't make sense to me.
Also, in this article they suggest to execute the commands in this order:
php artisan config:cache
php artisan config:clear
But this doesn't make sense to me. Shouldn't be the other way around? And I think the cache commands also clears the cache first.
The env() function is strongly recommended to be used only in configuration file, since caching the configurations, will make the env function to return null
In other words, crate a configuration file, with that environment variable, or add it to an existing one
It's hidden in an old update guide this "note"

Laravel CPanel - New Image to public folder not showing

I have uploaded my Laravel app to CPanel and it works completely fine. Then, I was making some changes to the Views by adding some new blade files. I also add new images to the public folder, where I put my previous images and it was working completely fine. But when I load the new page, the images are not showing, only the older image that I have uploaded before.
The HTML tag is the same as the already existing image but why it is not showing?
This is the HTML tag that I use in the blade:
<img src="{{ url('images/logo-cimahi.svg') }}"/>
I put the images in the public/images/ for the already existing images but the new images in the same path not showing.
Does my image broken or do I have to do something with PHP artisan command?
Try to clear all Laravel's cache, just run the following command:
$ php artisan optimize:clear
This will be an ouput:
Compiled views cleared!
Application cache cleared!
Route cache cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!

Laravel preset React: problems encountered when `npm run dev` is executed

I have some issues with using React in Laravel 5.5. Every time I add or make changes to a component, I have to run npm run dev to compile the thing. When I do this the contents of css/app.css get reset, so I cannot write styles to this file.
Styles get unchanged if I have them in another CSS file, but I'd like to have my main styles written in css/app.css.
How can I do this?
Keep all your css styles in a file in your resources directory and add the below code to end of your webpack.mix.js file.
mix.styles('path to your css file in resources directory', 'public/css/app.css');
If you are using sass use the below code
mix.sass('path to your css file in resources directory', 'public/css/app.css');
Also you no need to run npm run dev each time you make changes to your components. just run npm run watch and it will continuously look for changes and re-compile the components if anything is changed.

laravel : php artisan not working

I know there is bunch of answer out there and none of them solved my problem. I am giving a try again in 2016 may be some one can help.
php artisan make:migration createxxxtable
don't show any error and it don't create the file
neither of these function output anything too.
php artisan list
php artisan help migrate
Its not new project. I had been working on this project earlier and it was working fine. Created bunch of migration.
I tried deleting everying inside vendor and do composer install and composer update still no luck.
I did tried command like dump-autoload , optimize , clear-compiled etc. too
Thanks
Ok found the solution. I don't know whats the reason. But it was because I was using url() helper in a custom config file i created in config folder. The config file and value of url and others works fine all across the website but it just break artisan command. I don't know why.
Removing that url() helper from my custom config file solved the problem.
Normally when this issue arises it's due to an error in your code. Check for these coporates
Could be a typo in your .env file
Could be a syntax error in your .env
Entering in wrong configuration(syntax error) in your config folder
can you please try php artisan does that open up the artisan commands?
If these doesn't show anything then check your path to project in console.

Assetic doesn't update styles without cache:clear

I have an app.less that imports everything (less) else if I comment a line in app.less app styles doesn't render the commented part, but if I change something in that imported less file, anything changes, I have to do cache:clear and to clear the browser cache to see the new style loaded...
Assets that are imported from another stylesheet (less, sass, whatever) will not be recompiled when they change, even if you use php app/console assets:dump --watch. See another question on StackOverflow and this issue in the AsseticBundle issue queue.
I came upon the same problem. This is caused because LESS is using your window.localstorage to save the rendered css file. For testing you could put in javascript
<script> /* Provisory for dev environment: */ window.localStorage.clear(); </script>
however this causes your page to load really slow. i have not found another options for this just yet.

Categories