anthonyshort / grunt-component-build

Build Components using Grunt.
MIT License
29 stars 12 forks source link

make component.json optional #21

Closed edjafarov closed 11 years ago

edjafarov commented 11 years ago

https://github.com/anthonyshort/grunt-component-build/blob/master/tasks/component_build.js#L76 need to check if component.json exists before requiring it. I want to get js files dynamically instead of supporting component.json

edjafarov commented 11 years ago

Lame, builder.js loads component.json anyway, unless you hack Builder.prototype.json which is great since you can inject config directly.

edjafarov commented 11 years ago

I did that and it works! But feels like a hack until builder.js will be fixed. Hope that will be done soon https://twitter.com/tjholowaychuk/status/344181701565624321

Until that my fork kinda works https://github.com/edjafarov/grunt-component-build

kewah commented 11 years ago

Hi,

I don't really see the benefit to define the component config in Gruntfile instead of a separated file (component.json). Do you have an example ?

Moreover I think your update doesn't cover all needs. Currently you can define images, fonts, scripts and styles properties (https://github.com/edjafarov/grunt-component-build/blob/master/tasks/component_build.js#L49-L52) but if I use the json builder plugin I need to define it too. For example

"json": [
  "path/to/a/json/file.json"
]
anthonyshort commented 11 years ago

Yeah I'm pretty against something like this. The whole point is to be able to build components. To build them without needing a manifest wouldn't be using Component properly. You'd be better off writing a custom grunt plugin for this that just gives access to the builder. But I still think it's a bad idea to go that way. 

edjafarov commented 11 years ago

Well, the reason behind this is to able to define scripts, styles and other assets as a wildcards (like in readme - "You can specify scripts and styles within Grunt and these will override the component.json file. "). And use builder.js for building local project (check https://github.com/edjafarov/compy/blob/master/Gruntfile.js#L21-L30). That would be great to have single grunt plugin for that and building separate components. Otherwise - yep forking separate plugin is ok.