Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Support for setting package copy order #19

Open
nmcclay opened this issue Mar 17, 2014 · 4 comments
Open

Support for setting package copy order #19

nmcclay opened this issue Mar 17, 2014 · 4 comments

Comments

@nmcclay
Copy link

nmcclay commented Mar 17, 2014

As far as I can tell grunt-bower copies package files in alphabetical order. Which is sometimes something you might want to actually control. For example I'm trying to use grunt-bower in conjunction with Sails.js automatic asset linking and its almost there except for I have no control over the order that packages are copied to the assets directory.

Could we possibly add a 'sort' parameter to the options property? Or possibly a 'order' parameter to the packageSpecific options?

Thanks!

@curist
Copy link
Owner

curist commented Mar 17, 2014

Will look into this soon, stay tuned.

2014-03-17 22:03 GMT+08:00 nmcclay [email protected]:

As far as I can tell grunt-bower copies package files in alphabetical
order. Which is sometimes something you might want to actually control. For
example I'm trying to use grunt-bower in conjunction with Sails.js
automatic asset linking and its almost there except for I have no control
over the order that packages are copied to the assets directory.

Could we possibly add a 'sort' parameter to the options property? Or
possibly a 'order' parameter to the packageSpecific options?

Thanks!

Reply to this email directly or view it on GitHubhttps://github.com//issues/19
.

@curist
Copy link
Owner

curist commented Mar 18, 2014

Have you come up with any implementation detail about this?
In my initial thought, sort option will take a callback, pass in all bower components' name as an array, and the callback function is responsible to return the names array in desired order.

Maybe it's not that convienient, or maybe it's all depends on one's javascript-fu.

@curist
Copy link
Owner

curist commented Mar 18, 2014

Another option would be take up to 2 parameters, high-priority and low-priority, both take names array. Copy order would be

  1. names in high-priority
  2. names not in high-priority nor low-priority
  3. names in low-priority

This would be much easier for users.

@nmcclay
Copy link
Author

nmcclay commented Mar 18, 2014

Honestly I'd take pretty much anything that would let me configure this order at all. If you are in the granting wishes mood though, I'd love being able to configure a 'weight' property in the packageSpecific options.

Something like -

grunt.config.set('bower', {
    dev: {
        dest: '.tmp/public',
        js_dest: '.tmp/public/js',
        css_dest: '.tmp/public/styles',
        options: {
            packageSpecific: {
                "jquery": {
                    "weight" : -1 // lower weight copies before anything else
                },
                "font-awesome": {
                    "weight" : 1 // higher weight copies after everything else
                },
                "underscore": {
                    "weight" : -20 // would load before jquery's -1
                }
            }
        }
    }
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants