linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

Plugin execution order is unable to be specified. #344

Open davemo opened 9 years ago

davemo commented 9 years ago

In releasing https://github.com/linemanjs/lineman-vendor-split I encountered a bug using the lineman-angular plugin in conjunction with lineman-vendor-split; users are unable to control the execution order of plugins.

The problem manifests itself in a project using lineman-angular due to the fact that the concat_sourcemap config is modified by both plugins yet lineman-angular expects lineman-vendor-split to go first so that the config is setup appropriately to modify.

Discussion with @searls has yielded a couple of options for users being able to define this, the simplest being simply exporting a function from a plugin that is then required in the config/application.{js,coffee} of the users lineman application.

ie:

module.exports = (lineman) ->
    require('lineman-vendor-split')(lineman.application.config) #mutates the config
    # other normal app config here
    server:
      enabled: true
    # etc
searls commented 9 years ago

If we want to take a serious look at this, the first step is probably reacquainting ourselves with the code that currently discovers plugins. It may provide a little insight into how ordering works now