ember-cli-compass-compiler icon indicating copy to clipboard operation
ember-cli-compass-compiler copied to clipboard

Asset subdirectories should compile to local path

Open cbornhoft opened this issue 9 years ago • 4 comments

Maybe I'm misunderstanding how this works but i'll see if I can explain first.

The default location for assets is <app-name>/public/assets, which then copy to <app-name>/dist/assets upon building. The problem lies in setting the default directories for any assets within ember-cli-compass-compiler.

Compass sets the font directory to /fonts by default. This causes warnings upon every build: WARNING: 'font.ttf' was not found in <app-name>/fonts but the fonts are found and work as expected in the browser.

To remove these warnings, I set the --fonts-dir option to public/assets/fonts. But compiling doesn't remove the public/assets portion, so naturally the browser can't find the font in <app-name>/dist/assets/public/assets/fonts.

Proposal: To me the default for ember-cli-compass-compiler should be public/assets/fonts which then compiles to fonts, since <app-name>.css already sits in the assets directory. This would remove the warnings and work as expected. Either that or like I said, I'm misunderstanding how to set the defaults properly.

cbornhoft avatar Sep 24 '15 21:09 cbornhoft

An example repo demonstrating the issue would be great. Can you submit that?

@cbornhoft ping.

quaertym avatar Sep 26 '15 01:09 quaertym

I was having the same issue and found a solution.

Goto root of ember project path

$ compass config

edit config/compass.rb and add

images_dir = "public/assets/images"
http_images_path = "/assets/images"

fonts_dir = "public/assets/fonts"
http_fonts_path = "assets/fonts"

javascripts_dir = "assets/"

generated_images_dir = "public/assets/images/sprites"
http_generated_images_path = "assets/images/sprites"

don't forget to add public/assets/images/sprites to .gitignore

@cbornhoft

designblooz avatar Oct 07 '15 16:10 designblooz

@quaertym maybe this can be part of README?

designblooz avatar Oct 07 '15 17:10 designblooz

@quaertym Sorry I've been tied up with other parts of the project. I can make an example repo if you'd like. Though I found the solution to the problem is the same as @designblooz

Only the config.rb setup allows use of the http_ options. If added to the compassOptions object, the build process throws errors that those properties are unknown.

Is there any way to be able to add the http_ options into the compassOptions object? I realize these don't seem to be command line options, which that object translates to, so I'm not sure how easily that could be implemented, if at all.

cbornhoft avatar Oct 07 '15 17:10 cbornhoft