romenigld

romenigld

Not found the background images

I installed the Dart Sass and I am trying to put a background image:

html {
  background: url(images/background.svg) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
}

my assets images has this:

$ tree assets/images
assets/images
├── background.svg
└── cryptos
    ├── btc.svg
    ├── eth.svg
    └── ltc.svg

And when I run the phoenix server I am having this log error:

[info] GET /assets/images/background.svg
[debug] ** (Phoenix.Router.NoRouteError) no route found for GET /assets/images/background.svg (PoeticoinsWeb.Router)
    (poeticoins 0.1.0) lib/phoenix/router.ex:406: PoeticoinsWeb.Router.call/2
    (poeticoins 0.1.0) lib/poeticoins_web/endpoint.ex:1: PoeticoinsWeb.Endpoint.plug_builder_call/2
    (poeticoins 0.1.0) lib/plug/debugger.ex:136: PoeticoinsWeb.Endpoint."call (overridable 3)"/2
    (poeticoins 0.1.0) lib/poeticoins_web/endpoint.ex:1: PoeticoinsWeb.Endpoint.call/2
    (phoenix 1.6.6) lib/phoenix/endpoint/cowboy2_handler.ex:54: Phoenix.Endpoint.Cowboy2Handler.init/4
    (cowboy 2.9.0) /Users/romenigld/workspace/elixir/poeticoding/poeticoins/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
    (cowboy 2.9.0) /Users/romenigld/workspace/elixir/poeticoding/poeticoins/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
    (cowboy 2.9.0) /Users/romenigld/workspace/elixir/poeticoding/poeticoins/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
    (stdlib 3.16.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

Compiled css/app.scss to ../priv/static/assets/app.css.
[debug] Live reload: priv/static/assets/app.css
[debug] Live reload: priv/static/assets/app.css

My project on Github

Marked As Solved

LostKobrakai

LostKobrakai

The default phoenix pipeline does no longer copy static assets. You need to put those files into priv/static/…

Also Liked

LostKobrakai

LostKobrakai

You could just not have the files in assets, but maintain them only in priv/static

mcrumm

mcrumm

Phoenix Core Team

Yes– these are the “digested” versions of your static assets. The hashes in the filename represent a specific version of your asset and they are used for cache-busting on the client-side. The ones with the .gz extension are created by the default gzip compressor. Check out the Phoenix.Digestor.Compressor for other compression options.

Yes– assets.deploy is a Mix Task alias defined in your mix.exs that builds and digests assets. Usually you only need to run this task for your production deployment, but running it locally is okay :slight_smile:

If you want to clean up all the digested assets, run the phx.digest.clean task with the --all flag:

$ mix phx.digest.clean --all
romenigld

romenigld

The problem was I downloaded the svg file with curl and I don’t now why it was like HTML code.
I downloaded now the SVG code and it worked.
Thank you"

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31586 112
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement