montagejs / mop

Montage Optimizer (mop): Minifies (to reduce file size) and creates bundles (to reduce the number of requests) of Montage applications.
Other
31 stars 15 forks source link

Allow packages to specify a processing step #12

Closed Stuk closed 10 years ago

Stuk commented 11 years ago

I've been thinking it would be really useful to allow a package to specify a processing/optimization step. For example the localization messages.json need specific processing which would be good to encapsulate in the montage repo, rather than in the mop repo.

Strawman package.json

{
    "name": "...",
    ...
    "optimizations": [
        "scripts/messages",
        "module-name/to-require/that-exports-a-function",
        ...
    ]
}

I'm not sure what arguments would be passed to the exported function.

kriskowal commented 11 years ago

Yeah, we do need some more knobs in package.json for run-time or mop-time extension-based compile and load middleware.

francoisfrisch commented 11 years ago

Maybe better in a mop.json

On Friday, January 18, 2013, Stuart Knightley wrote:

I've been thinking it would be really useful to allow a package to specify a processing/optimization step. For example the localization messages.json need specific processing which would be good to encapsulate in the montage repo, rather than in the mop repo.

Strawman package.json

{ "name": "...", ... "optimizations": [ "scripts/messages", "module-name/to-require/that-exports-a-function", ... ]}

I'm not sure what arguments would be passed to the exported function.

— Reply to this email directly or view it on GitHubhttps://github.com/montagejs/mop/issues/12.

kriskowal commented 11 years ago

It depends on whether the same information is useful at run-time too. With a CoffeeScript compiler, it would be useful. With the HTML loader, both. With our JSON loader, both. With the Minifier, only useful in the optimization step.

kriskowal commented 10 years ago

@stuk, would you agree that this issue is quite well addressed by the new knobs for "optimizers", "translators", "compilers" expressible in package.json in mr@v2?

Stuk commented 10 years ago

Yes.