It may sound counterintuitive, but Dr. Karp says it's essential to wake your baby as she's drifting off to sleep.
"When you have a little baby, it's OK to rock them to sleep and nurse them to sleep — in fact, you can't really stop them from falling asleep while they're nursing. However, they will get dependent on that. You [need to] feed your baby, swaddle your baby, turn on the white noise, and rock your baby to sleep. Then you slide them into the crib or bassinet and you wake them up — you tickle their feet or something and you wake them a little bit. They're drowsy, they're kind of drunk from the milk a little bit. They're swaddled, they have the white noise, so they tend to fall back asleep in five to 10 seconds. Or, at most, you jiggle the crib a little bit to get them back to sleep. In those 10 seconds, they're learning how to put themselves back to sleep in the middle of the night, without your help. So you can train a baby the wrong habits in the first few weeks, but you can also start training them the right habits in the first few weeks."
Source: Flickr user tiarescott