It’s quite interesting but I had no interest in trying out Netlify. I had just written my talk on Nuxt.js and my aim (which I did) was to show everyone how easy it was in Nuxt to deploy a static site to GitHub pages. And it really was easy.
However it took me a while to figure it out because the example of the docs didn’t work for me. What! are you telling me the docs were wrong? Well either they were wrong or it just didn’t work for me. So I managed to tweak the function and got it to work. It was a Saturday night at 11pm and I practically danced around the room because I managed to deploy to Github pages all on my own. I am a frontend developer, not a devops or backend person so I was really proud of myself and I thought let’s put it in a talk and tell everyone else about it.
So in Vue Day Verona in April, I did just that. I added it to my talk and live coded to show how easy it was to deploy a Nuxt static site to Github pages. Yes all you have to do is write a ternary operator in your nuxt.config (and object assign it to the module exports) to say, if it is development don’t add anything but, if it is production you need to add the name of your project as Github puts that in the URL and if you don’t create that then it will work in Github but not in your local environment so that can be quite annoying.
Then all you have to do is add 2 script tags to your package.json so that you can then generate and deploy.
And that’s it. Then all I have to do every time I want to have my changes live on my Github page is to add, commit, push and then just type the command to generate and then the deploy command. Super simple. Live coded it to show how it works and how easy it was and got a big applause so people also found it super helpful.
And it really is easy, I only have to write that ternary operator once and then when pushing yes I need to repeat those commands and as we always push and then see errors and then go back and fix things or add more things we push quite a lot especially to our own personal projects but as I am a clever developer I don’t have to write it all out again …generate:gh-pages…deploy… I can just use the up keys in my terminal so really it is just push, up key, enter, repeat that and bang it’s deployed. See how easy it is. Doesn’t take much time at all.
So when Alex Litchter from the Nuxt.js core team told me I should use Netlify I was like, why? Deploying to Github pages is so easy. It took me almost an hour to figure it out and I have it now. I don’t need to spend another hour trying to figure out Netlify. So I pretty much ignored people when they told me I should check out Netlify as I just didn’t feel the need.
Then it was a tweet I saw from Tim Benniks who said that in 5 minutes he had setup and deployed to Netlify. I thought well if Tim can do it in 5 minutes then really I should be able to too and 5 minutes I could possibly spare to then tell people that I have tried Netlify.
So I tried it out. I setup an account. I added my site from Github pages and oh shit here it is, I just pushed my changes and bang there it was on Netlify. I did it in just 3 minutes. No code to write, none at all, no script tag to write. Nothing. I was thinking oh my god why did I not just try this sooner. You see the thing is when we see something as easy we can’t believe that something can be easier than easy. Don’t get me wrong deploying to Github pages is easy but deploying to Netlify is just so much easier and normally when something is easier for a developer it is quicker and that means I can just write code and push and not have to worry about typing the deploy scripts actually I don’t even have to type the generate script as you just add that once to Netlify and then it just gets triggered when you push.
And there are so many other cool things that you just don’t get from Github pages. Netlify gives you a deploy summary so you can keep track of what you deployed and when, plus a deploy log so you can see if something went wrong. You can also stop auto publishing and preview a deploy, now that is cool. That means you can have different staging environments.
And you can even buy domain names right there on Netlify ohhh I so much love how the payment process works. It makes me just want to pay again. The image of the credit card gets filled in as you type, it’s just cool.
There are so many other features of Netlify that I haven’t played around with yet but will be doing as I am now moving all my sites to Netlify which you probably think is a lot of work. No, once I add my Github pages (you can use gitlab or bitbucket too) then I have access to all my repos and I just choose the right one add my settings and click deploy. That’s it. Super quick and super easy.
Oh and did I tell you that Netlify is free. Unless you need extra features but for the general average developer, yes it’s free.
And no I do not work for Netlify I just highly recommend it and to all those that have watched my talk or seen my slides then update — Move to Netlify or at least give it a try and make up your own mind but don’t be afraid to trying something new as that something might just be easier than easy.
You can also just check out the free video from Vue School on how to deploy to Netlify for Nuxt.js static sites.