fat/smoosh — Issue #15: add .reset() or make .config() reset state
Author: rvagg
Created: 2011-12-11 11:35:44+00:00
State: open

Use case: I have a project where I want to build the source doing the normal `.config({..}).run().build().analyze()` but I also want to do a `.config({...}).run()` on the test files without building and analysing them. Unfortunately because `_files` is global to smoosh, when you run subsequent `.config({})`s you're just appending to the files lists, so depending on the order, you either do a double `.run()` on all files specified in both `.config()`'s or you do a full `.run().build().analyze()` on everything.

My quick and dirty solution to this is to leave an empty `var _files;` in place and move the `_files = { ...}` into `_config.init()` so it's an effective reset. But of course that only works for me and not anyone else who runs smoosh on my project.

I'm happy to do the work on this and submit a PR if you let me know what direction you'd be happy to take: let `.config()` do an implicit reset or make an explicit `.reset()`.

There is one odd thing I haven't figured out yet which you might be able to give me a pointer to. I'm doing `.config({ .. 1st .. }).run().build().analyze().config({ .. 2nd .. }).run()` and it works fine (using my `_files` change) with the jshint, build and analysis (only 'uncompressed' and 'compressed') at the top or the first config and then the jshint for the 2nd under that yet there's the 'gzipped' bit for the analysis for the 1st config! Very strange that the gzipped analysis is split from the other analyses and it comes after my 2nd config where my 2nd config doesn't contain the file being gzipped or an `.analysis()`.