duojs / gulp

Use gulp plugins in duo without any extra work.
35 stars 4 forks source link

Example in README is confusing #4

Open cvan opened 10 years ago

cvan commented 10 years ago

I don't follow the example in the README.

var gulp = require('duo-gulp');

Is there any other way to use this plugin without wrapping gulp?

var duo = Duo(root).entry(entry);

What is root and entry?

duo.run(fn);

What is fn?

matthewmueller commented 10 years ago

Oh, it's using the Duo JS API: https://github.com/duojs/duo/blob/master/docs/api.md

Let me know if you're still confused. Feel free to open a PR making it more clear.

zeke commented 10 years ago

I had the same thought: It would be nice if the README example used working code.

cvan commented 10 years ago

I spent quite some time looking through the code, the tests, and the Gulp API, and I'm still unclear what's the canonical way of calling duo with gulp whenever my .js file changes.

cvan commented 10 years ago

Ah, I found a fantastic example in the duo repo: https://github.com/duojs/duo/blob/master/examples/gulpfile/gulpfile.js

matthewmueller commented 10 years ago

@cvan I need to make this more clear in the readme, but there are 2 different places gulp can be used:

  1. Duo can be integrated into your Gulp workflow, compiling JS and CSS files. The example you linked to shows that.
  2. Gulp plugins can also be used within Duo to support Stylus, SASS, coffeescript, etc. That is what this plugin is for.

Note that these can be used in unison.

cvan commented 10 years ago

@MatthewMueller Understood, thanks.

I didn't understand that duo-gulp was meant to be used with transforms only. Since there are tests for everything non-JS, that makes sense to me now.

I ended up just requiring Duo directly. Instead of wrapping gulp, it'd be nice if there was a gulp-duo plugin that did the duo boilerplate code that I added to my gulpfile, including the file watching. Maybe I'll eventually make one.

Anyway, thanks for your help!

matthewmueller commented 10 years ago

it'd be nice if there was a gulp-duo plugin that did the duo boilerplate code that I added to my gulpfile, including the file watching. Maybe I'll eventually make one.

+1!

sergeyt commented 10 years ago

@MatthewMueller, @cvan I just wrapped duo-gulp into gulp-duo with loading coffee, less, sass plugins . It could reduce mentioned duo boilerplate.