In many ways that is easier to do for reference books, because you are writing about a topic of specific interest and if you do it well, so that you answer questions and solve problems, then there is a good chance with enough visibility that people will buy those books, especially in a highly sought after topic.