ocombe / assetsmanager-brunch

Adds multiple assets folders support to brunch.
4 stars 4 forks source link

Multiple folders / dest #1

Closed raphaelgoetter closed 10 years ago

raphaelgoetter commented 10 years ago

Hello,

Thank you for this plugin witch could be very useful.

I'm trying to manage several folders and destinations, but this code doesn't work for me :

    assetsmanager:
      files: ['_dev/css/illust/*'],
      dest: 'css/illust',
      files: ['_dev/css/fonts/*'],
      dest: 'css/fonts',
      files: ['_dev/*.html'],
      dest: ''

Can you give me a little help ?

Thank you,

Raphaël

ocombe commented 10 years ago

You don't need this plugin anymore, you can handle multiple folders natively on brunch now :) Use this in your brunch config file (the folder names are an example) :

paths: {
        "public": 'public',
        "watched": ['app', 'dist', 'commons/app']
    }
raphaelgoetter commented 10 years ago

Hi thanks for answer. But assets and watchew folders are treated differently :watch only works with modified files witch have to be compiled. I have to copy/paste systematicly those folders, like assets (and not watched compiled files). Moreover, I have to paste thrm in differents folders.

How would You proceed that in native config file ?

(note that "_dev" is already watched in my config)

ocombe commented 10 years ago

Yes sorry I didn't read your question very carefully yesterday ... I think I'd have to change the lib to allow multiple assets paths/destinations kinda like the grunt plugins works. It only adds one for the moment if I read my code right (I haven't used my plugin for a long time), but it shouldn't be really hard to adapt. Do you have any syntax that you would recommend ?

ocombe commented 10 years ago

By the way, have you tried the convention option ? Once you have changed the watched folders (and added all you wanted), you might be able to do use something like that :

conventions: {
        assets: function(path) {
            path = path.replace(/\\/g, '/');
            if((path.indexOf('app/assets') > -1 || path.indexOf('bookmarklet/assets') > -1) && path.indexOf('sprites/') === -1) {
                return true;
            }
        }
    }

This is something I use, you would have the adapt the function in order to use regex for files types and path I think. Note that it won't let you choose the destination folder and will keep the existing file hierarchy.

raphaelgoetter commented 10 years ago

Hi (sinon, si t'es français, on peut en parler en français aussi ;))

I didn't manage with conventions.assets :/

Have you noticed @iamvdo 's fork (and pull request) ? https://github.com/iamvdo/assetsmanager-brunch

The idea seems promisefull.

The only issue is that only one destination can be provided.

It would be perfect with something like that :

plugins:
    assetsmanager:
        files: ['_dev/css/illust/*', '_dev/css/fonts/*'],
        dest: ['css/illust', 'css/fonts']

Therefore :

Would it be possible ?

ocombe commented 10 years ago

Oui en français ça me va. Je verrais plutot un truc comme ça:

plugins: {
  assetsmanager: {
    illust: {
      files: ['_dev/css/illust/*'],
      dest: ['css/illust']
    },
    fonts: {
      files: ['_dev/css/fonts/*'],
      dest: ['css/fonts']
    }
  }
}

C'est le principe des plugins grunt en règle général et ça reste plus modulable. Les noms des différents objets (illust / fonts) n'ont pas d'importance.

iamvdo commented 10 years ago

Sinon, mon fork semble fonctionner (hier soir il ne fonctionnait pas) :P

Ce qui donne:

plugins: {
  assetsmanager: {
    copyTo: {
      'css/illust': ['_dev/css/illust/*'],
      'css/fonts': ['_dev/css/fonts/*']
    }
  }
}

Et ainsi de suite ;)

ocombe commented 10 years ago

Effectivement c'est beaucoup plus compact et tout aussi compréhensible

raphaelgoetter commented 10 years ago

@iamvdo : hey cool !

Du coup, @ocombe, tu penses accepter le PR ou je dois basculer sur la version de @iamvdo ?

ocombe commented 10 years ago

Oui je l'accepte dès qu'il a corrigé un petit truc dans la doc :)

raphaelgoetter commented 10 years ago

Yay, et encore merci et vive la France :D

ocombe commented 10 years ago

Fixed with https://github.com/ocombe/assetsmanager-brunch/commit/491f4fd8fbdf6543da056f8ea92de5339be40b87