curist / grunt-bower

grunt task to copy bower installed packages to other folder(s)
MIT License
93 stars 27 forks source link

Add new option `expand` #23

Closed artch closed 10 years ago

artch commented 10 years ago

An option for organizing the file structure by package rather than placing them all in one directory. Useful when some filenames could intersect with each other.

bower: {
  dev: {
    dest: 'public/vendor/',
    options: {
      expand: true
    }
  }
}
/public
  /vendor
    /package1
      package1_file1.js
      package1_file2.js
      package1.css
    /package2
      package2.js
      package2.css

Or organized by file type in addition:

bower: {
  dev: {
    dest: 'public/',
    js_dest: 'public/js/'
    css_dest: 'public/css/',
    options: {
      expand: true
    }
  }
}
/public
  /js
    /package1
      package1_file1.js
      package1_file2.js
    /package2
      package2.js
  /css
    /package1
      package1.css
    /package2
      package2.css
curist commented 10 years ago

This is indeed a pretty good feature to have. My only complain is the name expand may cause some confusion. groupByPackage or similar may be more suitable.

artch commented 10 years ago

Well, it is widely used in the same context in grunt-copy for example.

Another options: expandByName, expandByPackage, sortByName, organize. Or we can come with another approach: an option flatten which is true by default, and setting it to false will work in the same manner.

curist commented 10 years ago

Alright, though I think expandByPackage is a little better, expand slowly making more sense to me.