I'm making a quick module whilst playing with D8, which I want to preprocess Stylus into CSS. The obvious choice for me, coming from D7, would be to use hook_preprocess_page, but it seems to have been removed from D8, or at least only in themes and not modules.

So just to reiterate, I have my module stylus, my file stylus.module and the function stylus_preprocess_page(&$variables), but no dice.

What would be the best D8 alternative?


This hook has not been removed, there are still preprocess hooks for modules:


| improve this answer | |
  • Aaaagh, it's because I hadn't cleared the caches. Well, I did clear caches but used drush cc all rather than drush cr so nothing happened. Rookie mistake. Whoops! – Matt Fletcher May 25 '16 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.