Using a buyed template on phoenix 1.6

Hi guys, I am very horrible with design skill so to build a website more beautiful I bought a template with a lot html, css js and is very pretty. I tried put the files on assets/js, assets/css etc; and after on assets/vendor/* but no successful. When load the page no one css, js, image, nothing is loaded. Where I put this file?!?! I didn’t really understand how Esbuild works besides it’s been a long time without writing a few lines of code with Phoenix.

My folder priv/static/ has only the default files when build a new project.

Assets that need no preprocessing (such the ones associated with your template) should go directly under priv/static.

See also: Asset Management — Phoenix v1.6.2

2 Likes

Thank you it is solve. But has just one little problem, all files on template refer to /assets/..., and the assets folder on priv/static is annotated in gitignore. So I would have that change all this or is better change the default place to app.js and app.css files of phoenix?

Things that live under /assets are processed by tools. On a fresh Phoenix 1.6 that’s esbuild. It outputs stuff into /priv/static/assets, that’s why /priv/static/assets is .gitignored - you commit the non-processed files (/assets) not the outputs (/priv/static/assets).

I would suggest:

  • Putting the CSS and JS files from the template under /priv/static/templates,
  • Changing the paths in the templates from /assets/... to /templates/....
5 Likes