RaveJS / rave

Zero-configuration application bootstrap and development
278 stars 8 forks source link

Base url option? #69

Closed Bitaru closed 2 years ago

Bitaru commented 9 years ago

Hi there! I just started new php project with Rave, and caught that BaseUrl is location.protocol + '//' + location.host + location.pathname, i think most projects use fixed path for assets so may be better to use '/' or load baseUrl from meta?

unscriptable commented 9 years ago

Hi @Bitaru!

Thanks for posting this. Help me understand your use case. Does either of these describe the problem you have or foresee?

  1. You have a multi-page app and the html documents may not all be in the same directory. The baseUrl would have to be different for each page.
  2. You have css, templates, and images in directories that are peers (or higher) to your JavaScript modules. You cannot access these from your JavaScript modules since rave doesn't let you access modules or assets above the module root (typically where you have the package.json or bower.json).

-- john

chrylis commented 9 years ago

I'm not yet using Rave (still under consideration for the SPA version of our site; doing the sections that need progressive enhancement now), but I can say that scenario 1 would apply to me.

Bitaru commented 9 years ago

Hi John!

First point exactly match for me - project have 3 locales and bases(/en/, /de/, /ru/). When rave start loading libs it drops 404 for packages, coz there is no folder /ru/ in project - GET http://more.dev/ru/bower_components/backbone/backbone.js 404 (Not Found) Also, i think, baseUrl from meta in init function will be great solution for scripts storage at cdn.

unscriptable commented 9 years ago

Anybody interested in tackling this one?