refactor requires in snippets.js