componentjs / builder2.js

builder for component
50 stars 20 forks source link

why does file.string = true; in css plugin #50

Closed azhang closed 10 years ago

azhang commented 10 years ago

In lib/plugins/css.js, why does it set file.string = true;? When I try

.use('styles', build.plugins.css())

it'll just output a css file with

true 
true 
true 
true

btw, the test doesn't get past installing font-awesome for me.

jonathanong commented 10 years ago

it's a shortcut for reading and setting the file

what happens? does it just timeout?

azhang commented 10 years ago

It can't find the repo at github so it tries looking at bitbucket.

  font-awesome
    1) should install

  symlink
    destination option

  76 passing (8s)
  1 failing

  1) font-awesome should install:
     Error: bitbucket returned mailformed JSON at URL: https://api.bitbucket.org/1.0/repositories/fortawesome/font-awesome/raw/4.0.3/component.json
azhang commented 10 years ago

I might be misunderstanding what build.plugins.css() is supposed to do. I don't see it in the builders/styles tests but output doesn't seem to match the documentation/what I'm reading in the code.

I'm using urlRewriter to achieve what I think build.plugins.css() is supposed to do. I think there might be an issue with yield file.read inside builders/styles#append

floz commented 10 years ago

The plugin.css() doesn't seem to work correctly. It creates a .css file with "true" for each css found; instead of the compilation of all the css.

It works well if we use https://www.npmjs.org/package/component-build instead.

floz commented 10 years ago

Ok my bad, it's not the plugin.css() as it's just detecting the css files. I also misunderstood what it's supposed to do.

Anyway:

build.styles(tree)
        .use('styles', build.plugins.css())
        .end(function (err, string) {
          console.log( "string", string );
          if (err) throw err;
          fs.writeFileSync('build/build.css', string);
        });

Is logging true instead of the css file content. So it results in a build.css containing true instead of the css code.

jonathanong commented 10 years ago

yeah it's weird. i don't like that now, wanted to be simple but it just made things more complicated

jonathanong commented 10 years ago

noticed that i actually ahd a bug, which this issue is about, though was unclear about. fixed now in 1.1.4