2

I use composer to install symfony-demo. (It's symfony demo project for learning and teaching)

I'm using symfony-demo repository.

I'm on a windows machine. Running php 7.

Installed folder is c:\www\symfony-demo\ Apache is installed and c:\www is root folder. loading http://localhost/symfony-demo/web works. The symfony application works.

However the assets like "/build/css/app.css" fail to load. The error status is 404 Not Found.

I think this is because I'm in a subdirectory of the root folder.

I've also tested running php bin/console server:run and testing it on 127.0.0.1:8000 but the results are the same. The css and js resources fail to load.

I'm comfortable editing Apache's .htaccess file. What am I missing? How do I either configure Apache or Symfony to find these resources?

3
  • all assets are loaded from the web folder of your application. make sure you user {{ asset(/path/to/css.css) }} Commented Jun 16, 2017 at 17:39
  • Have you ran php bin/console assets:install ? All resources (css, js, images) often is stored in the bundles folder (like in src/AppBundle/Resources/public). But this folder is not public (despite the public folder name) and you need to "transfer" all this resources to the real public folder, that is in web directory. When you run the assets:install command it does the job. Commented Jun 16, 2017 at 20:32
  • Yes, I've run the command and I have verified that the files are in the real public folder. Still these assets are not available. Commented Jun 16, 2017 at 21:27

2 Answers 2

1

The latest GitHub Repository fixed the error. The nightly build of the demo project did not have the assets. It now includes the missing css and js. The fix is mentioned in the commit.

Sign up to request clarification or add additional context in comments.

Comments

0

The documentation of the symfony-demo is lacking information about the new build tools it is using. Check out the new api to build the frontend assets in Symfony based on Webpack Encore.

You can find more information in these issues Manage frontend dependencies properly and Manage application assets with the new Symfony asset manager.

2 Comments

only "admin.css" is in the build/css folder. It is missing the app.css file. Running php bin/console assets:install produces: Installing assets as hard copies. OK - FramworkBund - Copy ![ NOTE] Some assets were installed via copy. [OK] All assets were successfully installed.
@geeves updated the answer to the current information

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.