Skip to content

Conversation

@grawk
Copy link

@grawk grawk commented Apr 16, 2014

By passing in the full "source" path of the file.

For my use case, I need to have more flexibility around which directory I move certain files to. Specifically, I expect bower components which (for component named mattc):

  • expect single directory with all templates: mattc/templates/*.dust
  • expect one or more locale based directory endpoint mattc/locales/{CC}/{lc}/*.properties where CC=country code and lc=language code

grunt-bower-task layout needs to:

  • copy mattc/templates/.dust -> public/templates/components/mattc/.dust
  • copy mattc/locales/{CC}/{lc}/.properties -> locales/{CC}/{lc}/mattc/.properties

To achieve this, the layout function almost could do it, but just needed the full component path of the file to complete the journey. E.g.

layout: function(type, component, src) {
    var loc, newpath;
    if (type === "properties") {
        //what is the {CC}/{lc} ?
        loc = src.match(/[A-Z]{2}\/[a-z]{2}/g);
        newpath = "../locales/" + loc + "/" + component + "/";
    } else if (type === "dust") {
        newpath = "../public/templates/components/" + component + "/";
    }
    return path.join(newpath);
},

@grawk
Copy link
Author

grawk commented May 2, 2014

Hi @yatskevich wondering if you could comment on this? It's a relatively minor change, unless you are in the process of changing this API.

@LeoColomb
Copy link

Big 👍.
But seems to be an unmaintained package...

@yatskevich
Copy link
Owner

@grawk merging it. Sorry for such a long delay.
We had this feature in our roadmap, thank you for implementing it 👍

yatskevich added a commit that referenced this pull request Jul 20, 2014
increase flexibility in custom layout function
@yatskevich yatskevich merged commit 3251aea into yatskevich:devel Jul 20, 2014
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

Successfully merging this pull request may close these issues.

3 participants