Template dependency tracking