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

Support absolute URLs for image resources. #8

Closed
addyosmani opened this issue Feb 5, 2015 · 6 comments
Closed

Support absolute URLs for image resources. #8

addyosmani opened this issue Feb 5, 2015 · 6 comments
Assignees

Comments

@addyosmani
Copy link
Contributor

So how are we going to handle images with material-design-lite? I see for example the checkbox still loads from url("../checkbox/tick.svg"), but that's not going to work for the minified version

We could include images/.. as one of the directories synthetically served during 'gulp serve' and just copy assets over to that directory during both gulp serve and the normal gulp build.

I still need to write a patch demonstrating how this could work.

@addyosmani addyosmani self-assigned this Feb 5, 2015
@passy
Copy link
Collaborator

passy commented Feb 5, 2015

I remember having a image_url helper back in the compass days. Is there something similar we could do in vanilla sass?

@sindresorhus
Copy link
Contributor

addyosmani added a commit that referenced this issue Feb 5, 2015
@yantakus
Copy link

yantakus commented Sep 4, 2015

I would like to say, than not everyone is using gulp. I'm using webpack with url loader and I have to manually rewrite all the urls to url(mdl/images/tick-mask.svg) for it to work properly. So maybe we can use a variable here to concatenate with image name. For example:

$img-path: mdl/images/; // _variables.scss


mask: url(#{$img-path}tick-mask.svg); //_checkbox.scss

Or even create a mixin like this:

mask: @include img-url(tick-mask.svg);

@RanzQ
Copy link

RanzQ commented Jan 12, 2016

I'm using webpack too and having problems with this... The latest version has ?embed suffix (for gulp-css-inline-images) but I don't know how to setup a webpack loader to discard the suffix and look for the svg file.

I haven't used gulp and don't know if there's a better option but a size based inlining tool would be better imo.

Maybe this? https://github.com/zckrs/gulp-css-base64

@yantakus
Copy link

@RanzQ I removed ?embed suffix and use url-loader for embedding SVGs:

    loaders: [
      {
        test: /\.svg$/,
        loader: 'url-loader?limit=100000',
      },
    ],

@RanzQ
Copy link

RanzQ commented Jan 12, 2016

@web2style yeah that's what I ended up doing too but for easier updates I like keeping the source in node_modules/ and only define custom variables and decide which components to import. Now I have to check on every update that my modified files are in sync. :)

Another option would be to fork this repo and install it.

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

5 participants