I uploaded my SF Application from my local (machine) to production (Cpanel server)
everything looks fine on production except the css, js, etc. (All files inside the web directory.
I open the var/logs/prod.log just to check whats happening and I find out these errors.
request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /stylesheets/base.css" (from "http://example.com/admin/login")" etc.........
Now, what I did is to open the base.html.twig and made changes on the path of css/js files.
From
<link href="{{ asset('stylesheets/base.css') }}" rel="stylesheet" />
To the full directory.
<link href="{{ asset('/home2/swipecom/public_html/web/stylesheets/base.css') }}" rel="stylesheet" />
By the way, here's the directory of the application in the server.
home/swipecom
cache
contactless (Where SF directories live)
- public_html (/web the only SF directory)
var
ssl
tmp
public_ftp
logs
I made it work using this code
<link href="{{ asset('web/stylesheets/base.css') }}" rel="stylesheet" />
Related
Good Day to You!
I am using Laravel 8 auth, running the following:
laravel new e_shop --jet --stack=livewire
php artisan vendor:publish --provider="Laravel\Fortify\FortifyServiceProvider"
npm install & npm run dev
php artisan migrate
on localhost, everything is working fine, but the online CSS register & login not working. :(
Here is the website location: http://www.gardoweb.com/e-shop
If&when you click on login, you see my problem.
Before I put online Laravel8 app I run the following, but it does not help:
php artisan optimize:clear
I deleted the bootstrap CACHE content.
In the public folder there are these files:
e_shop\public\css\apps.css
e_shop\public\js\apps.js
It was compiled with webmix.
e_shop\resources\views\layouts\app.blade.php the declaration as follows:
in the head ->
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
<script src="{{ mix('js/app.js') }}" defer></script>
So that's all, I don't know what to do next, I am on godaddy.
Thank you for your response, good day!
I'm encounting a problem with assets. My problem seems simple but I can't find a solution. I have search Google and other earch engines, as well as StackOverflox, Github.
I just want to use the asset function in twig templates. The code is very simmple:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}" />
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
{{ knp_menu_render('AppBundle:MenuBuilder:mainMenu') }}
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>
I just want to add Bootstrap stylesheet in my app. But when I refresh my page, I get an 500 Internal Server Error for the stylesheet. The rest of the page shows up but it can't retrieve the sheet. The URL requested is
http://arthur-dev.lyon-bercy.ratp:84/css/bootstrap.min.css
My development domain is http://arthur-dev.lyon-bercy.ratp:84/. So nothing strange in the requested URL. But shouldn't there be a reference to app_dev.php? And when I manually request http://arthur-dev.lyon-bercy.ratp:84/app_dev.php/css/bootstrap.min.css, the Symfony Framework shouts a
"No route found for "GET /css/bootstrap.min.css"
I have cleared the cache, installed the assets with absolute path or relative path, symlinked or hard linked. Nothing resolved my issue.
I'm using Symfony3.4 with Nginx and PHP FPM 7.2 under docker. Here are the exact configuration files:
config.yml: https://framabin.org/?771da57e9f933f5c#A9RmC/Ld0y8k7SZ5EoWCBkcjVF/VWHRO6+tT7d2e3/s=
composer.json: https://framabin.org/?0a3e9ae8ec9ff32c#gmg7lnD3fAkAlBkX408yn8Jr4buuBEt1GosqvGggvm8=
composer.lock: https://framabin.org/?55a3c320d4e6ee9a#YB0fyupuUJL5SGYeZyJI/jGOf53HTd/xudExwCr9+N8=
docker-compose.yml: https://framabin.org/?0583b288a0b7c071#Z9ATFv8QYmfkTidC8F1xehzfM3SjOtW+rRgop9t6ddU=
PHP dockerfile: https://framabin.org/?dd514d9548b1545b#EEmexWzgNzE2W6ODktu5iB3QWATJGz+xZV7B73Fy2gI=
nginx dockerfile: https://framabin.org/?160536a41c6d857c#iK6w74WKm3Q2OKWSP/j6EPdePvc5avxqgqqX74VF91o=
For Information, I tried with AsseticBundle but I get an issue too :
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "_assetic_3d14251_0" as such route does not exist.").
Any help is the most welcome
EDIT: Added link to config.yml file
I have found the solution for my problem. I give here the answer.
As I mentionned in my message I use Docker to create my environment. It is based on Maxpou's Symfony with Docker project (https://github.com/maxpou/docker-symfony).
The project isn't up-to-date with the Symfony 3.4. So there are some correction to do. I will make a PR later but here for information the solution: just add the following line in docker-compose.yml at the nginx level:
volumes:
- ${SYMFONY_APP_PATH}:/var/www/symfony
So now it looks like that:
nginx:
build: nginx
ports:
- 84:80
volumes:
- ${SYMFONY_APP_PATH}:/var/www/symfony
The issue was that Nginx didn't have access to the directory with the assets so it returned a 404 page. Now, the file is available directly in Nginx.
I'm having a strange issue in my Laravel 5.2 app. Specifically with loading some CSS and JavaScript files. I have this in the folder public/assets so, I have something like this:
|--public
|----/assets
|-------/css
|------------/auth
|---------------login.css
|----------main.css
|-------/js
|---------email.js
|---------/modules
|------------faq.js
That is my directory, so I'm loading the CSS with:
<link href="{{ URL::asset('assets/css/main.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ URL::asset('assets/css/auth/login.css') }}" rel="stylesheet" type="text/css" />
And the JavaScript files with:
<script src="{{ asset('assets/js/email.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/js/modules/faq.js') }}" type="text/javascript"></script>
Also I'm loading another files as well but I'm explaining the basic situation. So, the thing is that the load of login.css and faq.js are giving me 404 error but the other files are loaded correctly, I even checked open the files through the absolute paths and they're loaded fine, also I made chown to www-data of the public folder but nothing works, so I don't know why a 404 error is triggered. What else should I check?
In the console of the browser the links that are loaded are:
http://mydomain/assets/js/modules/faq.js
http://mydomain/assets/css/auth/login.css
But they give 404 error, and the other files doesn't
first check those 404 files are in there definitely
check those files have readable permisstion
I am trying to set up a website using Jekyll and GitHub Pages (first-timer), and most importantly, to style it with Bootstrap.
You can check what I have already done:
GitHub repository: https://github.com/thibaudclement/wallaby
GitHub page: http://thibaudclement.github.io/wallaby/ (check gh-pages branch)
Also, I followed this tutorial to import Bootstrap into the Jekyll structure.
Layouts and includes seem to work just fine, but I don't understand why my index.html does not get "styled" as it should, fetching information into the css/style.css file.
Any idea of what I am doing wrong?
Thanks.
The path to your css file is incorrect - it's not loading if you check your browser console
"Failed to load resource: the server responded with a status of 404 (Not Found) - http://thibaudclement.github.io/wallaby/style/site.css"
In _config.yml, you need to set baseurl: /wallaby.
And use {{ site.baseurl }} to load resources like this :
<link href="{{ site.baseurl }}/css/style.css" media="screen" rel="stylesheet" type="text/css" />.
See Jekyll documentation.
Just having a few problems trying to get Assetic to generate the combined links in rendered webpages. The files themselves are being generated fine, but in the web page in the production environment, I'm continuing to see the seperate file URLs (which do not work in production, as those uncombined files aren't available).
In a template, I have:
{% stylesheets
'#TBundle/Resources/public/css/bootstrap/bootstrap.css'
'#TBundle/Resources/public/css/bootstrap/bootstrap-responsive.css'
'#TBundle/Resources/public/css/jquery-selectbox/jquery.selectBox.css'
%}
<link href="{{ asset_url }}" rel="stylesheet" media="screen" />
{% endstylesheets %}
In production, this is still rendered as:
<link href="/css/2f787d0_bootstrap_1.css" rel="stylesheet" media="screen" />
<link href="/css/2f787d0_bootstrap-responsive_2.css" rel="stylesheet" media="screen" />
<link href="/css/2f787d0_jquery.selectBox_3.css" rel="stylesheet" media="screen" />
Despite that, when I invoke php app/console assetic:dump --env=prod I get:
11:13:43 [dir+] /var/www/tbundle/app/../web/css
11:13:43 [file+] /var/www/tbundle/app/../web/css/2f787d0.css
I'm using the default Assetic settings from Symfony2. Any thoughts on what might be causing this?
I had this exact same problem, and for me the issue was in my app.php file. I was loading the kernel as follows:
$kernel = new AppKernel('prod', true);
It appears as though this caused the function to not run in debug mode and combine the assets. When i changed the second argument to false, the assets successfully combined on production and remained uncombined on dev:
$kernel = new AppKernel('prod', false);
Also, you can pass combine=true as an argument to explicitly request that the assets get combined just to test that this functionality is working properly.