I published my first Magento 2 module, it’s very simple but effective: add the LiveReload script to the head without touching your theme files and only if you are in developer mode.
You can check it out here: https://github.com/nicolasblancom/magento2-module-liverealoadscript and easily get it installed with Composer.
LiveReload?
When developing a theme for Magento 2, it’s very nice to have your styles modification automatically refreshed in the screen without the need of actually refresh the page. That’s what LiveReload does.
So… Why this module?
There is a “problem”: you need to add a script tag to the web in order to make it work.
So the most common way is to add it to a layout file but… when you push changes to your repo you also push that script, so when deploying it to production it will also be there. Not something we want, this script it only for theme development purposes!
I needed some way of enable and disable this script output and some way to automatically disable it when production mode is enabled.
That is what this module does.
Final thoughts
This is a very simple module. But there are many other ideas of simple modules I would like to make, and this is a way of starting this path. It makes my happy and I enjoyed it more than I first thought I would 🙂