Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
biks152207 opened this issue Sep 18, 2016 · 10 comments
Closed

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

biks152207 opened this issue Sep 18, 2016 · 10 comments

Comments

@biks152207
Copy link

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

@chandruk4321
Copy link

chandruk4321 commented Sep 22, 2016

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
Copy link

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}/`,
    

@Gusi
Copy link

Gusi commented Sep 24, 2016

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

@syzer
Copy link

syzer commented Oct 31, 2016

👍

@syzer
Copy link

syzer commented Oct 31, 2016

@Kannach solution works for me!

@smeks
Copy link

smeks commented Nov 13, 2016

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.

@ghost
Copy link

ghost commented Dec 6, 2016

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

@smirciat
Copy link

smirciat commented Jan 2, 2017

#2188 might be related

@Awk34
Copy link
Member

Awk34 commented Jan 2, 2017

^ closing, assuming the same solution will fix it

@Awk34 Awk34 closed this as completed Jan 2, 2017
@MichaelJCole
Copy link

MichaelJCole commented May 15, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants