@gonvaled wrote:
I am running:
» ember --version version: 1.13.13 node: 0.12.2 npm: 2.14.10 os: linux x64
My application needs to be aware of the STATIC_URL where it is being deployed (which depends on the deploy environment "development" / "production") at two different stages:
- when building the application, in order to use the right fingerprint
prepend
- on the client application, in order to prefix static assets with the right url
First I thought about defining a
STATIC_URL
variable onconfig/environment.js
(where I have access to the environment parameter), and then do inember-cli-build.js
:// TODO: This does not work import config from './config/environment'; module.exports = function(defaults) { var app = new EmberApp(defaults, { fingerprint: { enabled: true, prepend: config.STATIC_URL, }, }); return app.toTree(); };
But I am unable to import the config environment:
import config from './config/environment'; ^^^^^^ Unexpected reserved word
Probably what I am trying to do does not make much sense (passing values upwards from
config/environment.js
->ember-cli-build.js
). So instead of that, what I need is:
- Access the build environment parameter ("development" / "production") from
ember-cli-build.js
. This should be already available, since the ember-cli guide specifies that fingerprinting is by default only available in production:app.env === 'production'
. But I need to accessapp.env
beforeapp
is even defined. How to do that?- Configure a
STATIC_URL
- Pass the
STATIC_URL
parameter down toconfig/environment.js
(to avoid reconfiguring it again for the client application)How can I do 1 and 3?
Posts: 11
Participants: 2