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

add conf.remove() and conf.add()? #157

Open
eivindfjeldstad opened this issue Feb 2, 2014 · 3 comments
Open

add conf.remove() and conf.add()? #157

eivindfjeldstad opened this issue Feb 2, 2014 · 3 comments

Comments

@eivindfjeldstad
Copy link

Having a hook to compile templates while using the new plugin API seems to be very difficult ATM. Would be useful to have some way to add/remove scripts before they touch plugins like commonjs. Maybe something like:

build.each('templates', function (file, conf) {
  conf.remove('templates', file);
  file.contents = jade(file.contents);
  file.filename = 'template.js';
  conf.add('scripts', file);
});

Would you accept a PR?

@eivindfjeldstad
Copy link
Author

I could just use push() and splice() but then the behavior of build.each() needs to change.

@ianstormtaylor
Copy link
Contributor

was debating a very similar thing in a similar project. the other solution would be to eliminate the Build object with the each helpers and let people act directly on the {} itself so they can delete obj.key and obj[key] = ...

couldn't figure out which one was best. one is nicer for plugin writing, the other is most flexible

This was referenced Feb 19, 2014
@bergie
Copy link

bergie commented Apr 25, 2014

Also related: #125

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