demo
demo copied to clipboard
assets are not loading after installation
Tried all the possibilities to install Symfony Demo (with symfony and composer) but when start Symfony Demo website, assets are not loaded.
Seems like there is some syntax error in a "content.js" in your code.
But the sourcemaps error is apparent upon every fresh installation of the demo.
Sources get loaded, but sourcemaps are not. This is a little bit annoying as there are dozens attempted to be loaded (from the vendor folder in project-root) and slow down local performance. As the sass-bundle always creates the compiled css with flag "--embed-source-map" when debug is enabled, there is no way to get rid of these errors but disabling debug. But then you will run into another issue: the sourcemap is nevertheless embedded with "app.output.css.map", which can also not be found and results in another 404. But at least you can still use your scss without dozens of sourcemap errors.
scss compiled with debug disabled:
default sass-bundle build (debug enabled):
We don't have any content.js
asset in this project, right? If this is correct, maybe this comes from some browser extension?
I tried again, and when I choose to run:
- $ symfony serve
- it works perfectly
- $ php -S localhost:8002 -t public/
- the symfony demo does not work - the problem with assets as described Just to clarify the issues...
I can reproduce it with php -S localhost:8000 -t public
, but works fine with php -S localhost:8000 public/index.php
.
I'm not an expert for the build in php server (I'm using the symfony cli for dev), but i guess we have to pass the index.php as "router" script ?
But should the demo still "supports" the build in php server, as it was removed from the symfony documentation since 3.4 (https://github.com/symfony/symfony-docs/pull/11567) ?
This is how I set this up now:
composer create-project symfony/symfony-demo==2.5.1 symfony-demo
echo "APP_ENV=prod" > symfony-demo/.env.local
cd symfony-demo
composer install
php bin/console asset-map:compile
Hopefully that helps someone. the key is php bin/console asset-map:compile
, which I got from the asset mapper documentation.