generator-angular-fullstack icon indicating copy to clipboard operation
generator-angular-fullstack copied to clipboard

font, background image url path not working from the app.css

Open biks152207 opened this issue 10 years ago • 10 comments

I have app.css generated by yo angular-fullstack with .css stylesheet.I am trying add background image from app.css "background: url("/assets/images/top-background.jpg") no-repeat;" however it doesn't show up in the frontend.This is even not working for fonts.The path doesn't seem to work.Any images or fonts loading from app.css are not working at all.Guys please help me

biks152207 avatar Sep 18 '16 00:09 biks152207

I have the same issue. However, when i serve using gulp seve:dist, all fonts adn images are working

-create a fresh project with latest generator

  • add a font awesome element in main.html
  • run glup serve (the font awesome image not shown.. shown as a rectangle)
  • run gulp serve:dist (font awesome works fine)

Let me know if you need more details

chandruk4321 avatar Sep 22 '16 13:09 chandruk4321

I had to change the following line to make it work

  •        publicPath: BUILD || DEV || E2E ? '/' : `http://localhost:${8080}/`,
    
  •        publicPath: BUILD || DEV || E2E ? `http://localhost:${3000}/` : `http://localhost:${8080}/`,
    

chandruk4321 avatar Sep 23 '16 11:09 chandruk4321

On windows, I had to change to:

publicPath: BUILD || DEV || E2E ? 'http://localhost:3000/' : 'http://localhost:${8080}/',

But I've only tried with gulp serve by now

Gusi avatar Sep 24 '16 10:09 Gusi

👍

syzer avatar Oct 31 '16 23:10 syzer

@kannach solution works for me!

syzer avatar Oct 31 '16 23:10 syzer

I tested the change for publicPath: http://localhost:${3000}/ and the fonts load properly on the local dev machine but any remote devices will not be able to load the page since all resources will try to load from localhost instead of the relative server path.

smeks avatar Nov 13 '16 14:11 smeks

@kannach solution is not working for me. Can anybody help me out?

ghost avatar Dec 06 '16 16:12 ghost

angular-fullstack/generator-angular-fullstack#2188 might be related

smirciat avatar Jan 02 '17 09:01 smirciat

^ closing, assuming the same solution will fix it

Awk34 avatar Jan 02 '17 15:01 Awk34

Hey, ran into this. npm start runs node server.js. So it seems to be designed to work with gulp build. If you want to run a development server, use gulp serve.

FYI: The workaround above broke deploying to heroku because all the built paths were pointing to localhost.

MichaelJCole avatar May 15 '17 17:05 MichaelJCole