DukeLeNoir/noiseGen — pull request #8 by adambiggs (2012-06-14 23:46:22+00:00)
Title: Option to generate new CSS rules instead of using inline styles.

I am loving noseGen for development. One less reason to open Photoshop!

This pull request allows you to pass an optional CSS selector as the first argument, which generates a new CSS rule instead of applying the styles inline for each element.

This allows one noise pattern to be reused as many times as you'd like without the overhead of generating new patterns (it can take > 100ms even for very simple patterns). Also makes the HTML look much cleaner when you're inspecting elements :)

Usage:

```
// normal usage unchanged
$('#foo').noiseGen({
// options
});

// generate CSS rule instead
$.fn.noseGen('#foo, .noise, .any-other-selector', {
// options
});
```

**Note:** $.fn.newCssRule (line 14) is very basic and most likely won't work in old browsers... But it would be very easy to flesh-out a bit more for compatibility. I just don't need that for the project I'm working on.