cssdream / cssgrace

从今天起,写简单优雅面向未来的 CSS。From now on,writing brief,elegant,future-oriented CSS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTP urls break build

jsalonen opened this issue · comments

Use the following test.css to reproduce:

.foo {
  background-image: url("http://www.example.com/image.png");
}

Running results in:

C:\Users\User\Project\node_modules\postcss\lib\lazy-result.js:175
            throw error;
                  ^
Error: ENOENT, no such file or directory 'C:\Users\User\Project\http:\www.example.com\image.png'
    at Error (native)
    at Object.fs.openSync (fs.js:500:18)
    at syncFileToBuffer (C:\Users\User\Project\node_modules\cssgrace\node_modules\image-size\lib\index.js:58:23)
    at module.exports (C:\Users\User\Project\node_modules\cssgrace\node_modules\image-size\lib\index.js:100:18)
    at imageSetMixin (C:\Users\User\Project\node_modules\cssgrace\lib\index.js:423:9)
    at C:\Users\User\Project\node_modules\cssgrace\lib\index.js:477:5
    at C:\Users\User\Project\node_modules\postcss\lib\container.js:119:34
    at C:\Users\User\Project\node_modules\postcss\lib\container.js:104:26
    at Rule.each (C:\Users\User\Project\node_modules\postcss\lib\container.js:91:22)
    at Rule.eachInside (C:\Users\User\Project\node_modules\postcss\lib\container.js:103:21)

Using cssgrace 2.0.2 on Windows 7

There is no support.
Next version fixed.

Hi!

Thank you for your quick response.

I don't need cssgrace to resolve background images over HTTP. I just need that the build won't break if I have these urls in my stylesheet.

Looking forward to the next version.

commented

Hi! How is work on the next version going? I just started a fork to do 2 things:

  1. to split out each rule into its own .js file, instead of keeping them all in one index.js file
  2. to make cssgrace configurable.

I need to disable the image handling in my own project. When I'm done, would you like me to submit a pull request, or are you already working on this?

commented

I split all the tasks out in my fork at https://github.com/zenbrent/cssgrace

I also made it so it doesn't process images that aren't referenced with image-width or image-height, so if I'm using an image that is served at a different path than it is on my hard drive, there isn't an error. (e.g. I reference url(/images/logo.png), but that's obv. not how it's set up on my computer.)
I haven't made it configurable yet, I may do that in the future.

I agree with #10 that some of these features would be best served as a separate project. For my job, I don't want cssgrace to handle my images, but I do want it to make my css work with older browsers! For my personal projects I would love the image handling, but I don't care about very old browsers.

As always, thank you for all your work. This is a very useful and well-done project. :)

@zenbrent

Thank you for your work!

Yeah, the next version I will "to split out each rule into its own .js file" and add browser config.

Maybe like this:

input:

@browser ie>=8;

.foo {
  display: inline-block;
}

output:

.foo {
  display: inline-block;
}

When you need to be compatible with the old browser, the output of the corresponding syntax sugar.

input:

@browser ie>=6;

.foo {
  display: inline-block;
}

output:

.foo {
  display: inline-block;
  *display: inline;
  *zoom: 1;
}
commented

Ok, awesome! Would you like me to submit my changes as a pull request?

I'm also waiting for this issue's fixed anxiously

@miniflycn I'm sorry, I'll fix it soon.

@zenbrent No problem! I am looking forward your pull request.

Hi @yisibl any updates on this?

url绝对路径的问题,依旧没有解决啊