Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add .reset() or make .config() reset state #15

Open
rvagg opened this issue Dec 11, 2011 · 0 comments
Open

add .reset() or make .config() reset state #15

rvagg opened this issue Dec 11, 2011 · 0 comments

Comments

@rvagg
Copy link
Contributor

rvagg commented Dec 11, 2011

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().

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

No branches or pull requests

1 participant