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

Solution for relative paths in CSS files in development mode? #50

Open
ragulka opened this issue Mar 29, 2013 · 2 comments
Open

Solution for relative paths in CSS files in development mode? #50

ragulka opened this issue Mar 29, 2013 · 2 comments

Comments

@ragulka
Copy link
Contributor

ragulka commented Mar 29, 2013

First of all, great work! This is probably the best asset manager for node I've tried so far.

On to my issue. My app structure is following:

/vendor/css/bootstrap.css
/public/img/glyphicons-white.png

When I run in dev mode, Nap will insert a link tag that points to /assets/vendor/css/bootstrap.css
In production mode, Nap will point to /assets/libs-ae4bf06b18b81f6c487955a5b3ea5d2b.css

This means that in dev mode, the relative paths to ../img/glyphicons-white.png will result in a 404, because the browser tries to look for /assets/vendor/img/glyphicons-white.png, but the file is actually located in /img/glyphicons-white.png

Any ideas how to solve this? Perhaps Nap should server files in dev mode from root, like /assets/bootsrap.css?

@madhandennis
Copy link

Hi, have you tried just editing the boot strap CSS and make the image paths absolute?

Also you can use nginx to serve your static assets during production and put a HAProxy in front. I am using such a setup and it works wonderfully and this way you will offload static asset serving from node.

But yea converting all image urls to absolute (if possible) will save you a lot of headache.

Cheers

Sent from my iPhone

On 29 Mar, 2013, at 4:53 PM, ragulka notifications@github.com wrote:

First of all, great work! This is probably the best asset manager for node I've tried so far.

On to my issue. My app structure is following:

/vendor/css/bootstrap.css
/public/img/glyphicons-white.png
When I run in dev mode, Nap will insert a link tag that points to /assets/vendor/css/bootstrap.css
In production mode, Nap will point to /assets/libs-ae4bf06b18b81f6c487955a5b3ea5d2b.css

This means that in dev mode, the relative paths to ../img/glyphicons-white.png will result in a 404, because the browser tries to look for /assets/vendor/img/glyphicons-white.png, but the file is actually located in /img/glyphicons-white.png

Any ideas how to solve this? Perhaps Nap should server files in dev mode from root, like /assets/bootsrap.css?


Reply to this email directly or view it on GitHub.

@ragulka
Copy link
Contributor Author

ragulka commented Mar 29, 2013

Yeah, I would like to avoid changing the paths if possible.

Illimar Tambek

On 29.03.2013, at 11:13, Madhan Dennis notifications@github.com wrote:

Hi, have you tried just editing the bot strap CSS and make the image paths absolute?

Also you can use nginx to serve your static assets during production and put a HAProxy in front. I am using such a setup and it works wonderfully and this way you will offload static asset serving from node.

But yea converting all image urls to absolute (if possible) will save you a lot of headache.

Cheers

Sent from my iPhone

On 29 Mar, 2013, at 4:53 PM, ragulka notifications@github.com wrote:

First of all, great work! This is probably the best asset manager for node I've tried so far.

On to my issue. My app structure is following:

/vendor/css/bootstrap.css
/public/img/glyphicons-white.png
When I run in dev mode, Nap will insert a link tag that points to /assets/vendor/css/bootstrap.css
In production mode, Nap will point to /assets/libs-ae4bf06b18b81f6c487955a5b3ea5d2b.css

This means that in dev mode, the relative paths to ../img/glyphicons-white.png will result in a 404, because the browser tries to look for /assets/vendor/img/glyphicons-white.png, but the file is actually located in /img/glyphicons-white.png

Any ideas how to solve this? Perhaps Nap should server files in dev mode from root, like /assets/bootsrap.css?


Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHub.

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

No branches or pull requests

2 participants