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

How to specify asset urls after baseUrl deprecation? #143

Open
tschoartschi opened this issue Nov 28, 2016 · 1 comment
Open

How to specify asset urls after baseUrl deprecation? #143

tschoartschi opened this issue Nov 28, 2016 · 1 comment

Comments

@tschoartschi
Copy link

Hey!

After fixing the baseUrl deprecation I've got the problem that specifying the urls for assets in a scss file becomes quite tricky. In our setup I know the baseUrl (or nowadays the rootURL) at build time and not when I write the scss file. I opened a thread on discuss.emberjs.com for more details click here.

I also built a "hacky" solution which works fine for us but I'm interested what would be a good approach to solve this problem. Are there any plans in solving this issue within ember-cli-sass?

Thanks a lot

@nmcclay
Copy link

nmcclay commented Jul 7, 2017

I have also had similar problems with this, after digging a little bit I found this approach to use the function feature of sassOptions:
https://stackoverflow.com/questions/33025880/is-it-possible-to-pass-environment-variables-to-ember-cli-sass-during-build

This let me pass through an environment option that I could use for my asset URLs, you could possible do something similar with rootURL if you needed to:

$rootURL: '';

@if environment() == 'development' {
  $rootURL: '/foobar';
}

.image {
  background: url('#{$rootURL}/images/images.png');
}

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