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

Passing config to tasks #1

Open
Dmitry-N-Medvedev opened this issue Jan 19, 2016 · 5 comments
Open

Passing config to tasks #1

Dmitry-N-Medvedev opened this issue Jan 19, 2016 · 5 comments

Comments

@Dmitry-N-Medvedev
Copy link

Hi,

what is the recommended way to pass settings to a gulp task?

@lmammino
Copy link
Owner

Hello @Dmitry-N-Medvedev , as I explained in this post on my blog this is something that is still missing out of the box.

I am figuring out a way to do it which should be simple to use and flexible.

One my current ideas is to modify the initialization function to support a structured object with options as an argument. E.G.

var gulp = require('gulp');  
var cozy = require('gulp-cozy');  
cozy(gulp, {
  "build-css" : {"files": [
     "./node_modules/bootstrap/dist/css/bootstrap.css",
     "./node_modules/some_other_lib/some_other_style.css",
  ]}
});  

The build-css sub-object will be passed to the build-css factory function. This should allow to provide some configurability to the factory function.

Of course you can add more key/value pairs, one for every "factory function module" that you have in your gulp folder.

This might work, but I am not entirely convinced that this is the best option. Ideally I would be able also to use the build-css factory function more than once with different configurations if needed (E.G. build a different set of CSSs, using the same pipeline but with different configurations), but at the moment I haven't figured out a simple way to do this without making the whole module more complex and exposing more specialized functions.

Any thoughts on this would be really appreciated.

Thanks

@lmammino
Copy link
Owner

@Dmitry-N-Medvedev, I am currently working on a more flexible version (that should be tagged as v1.0.0). They way the module will be used will change a bit. I am going to document all the process. In the meantime if you want already to have a look at how the implementation might look like you may give Branch v1.0.0 a shot 😉

@amobiz
Copy link

amobiz commented Jan 27, 2016

Hi, I have a similar project gulp-chef that do config things (for gulp 4.0). Maybe we can work together to make better solutions?

@lmammino
Copy link
Owner

Hey @amobiz, nice to meet you and thanks for you comment.
I had a quick look to your repository and it seems very interesting. I will check it out better during the next days to go through the details.

As you can see from my previous comment, I am currently working on a new version that should make things a little bit more flexible, but I am quite sure we can borrow concepts from each other and maybe come up with a single unified solution.

I'll let you know in the upcoming days.
Meanwhile if you would like to invest some time to understand what I am currently doing you can have a look at the v1.0.0 branch, specifically the main module file (at this stage I still have to update the docs and to write tests for the new features).

Any comment/critique/suggestion is absolutely welcome!

😉

@amobiz
Copy link

amobiz commented Jan 28, 2016

Sure! Thank you for reply. I'm very excited.

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

3 participants