Hello, I tried to deploy a static site by modify package.json and by adding a now.json file both which would hint to now that { "type": "static"} as I have no need for server rendering for a particular experiment.
However, it seems that when clicking on "deploy" both package.json and now.json are ignored. Another use for now.json would be to include an alias configuration.
Please let me know if I'm "doing it wrong" and there is some way to deploy a site statically. Static deployments don't count against your total deploy count, which is another advantage.
Hey! I think we need to manually tell the API of now to use static as upload method. Which shouldn't be too hard since we have the files available to infer this. We can do that here: https://github.com/CompuIves/codesandbox-client/blob/master/packages/app/src/app/store/modules/deployment/actions.js#L44-L45.
I'll like to take a stab at this. Will changing the deploymentType to static solve this? @CompuIves
That will fix it @HackAfro! I'd greatly appreciate the help ๐! Please check CONTRIBUTING.md to find out how sign in works in local environment (we will make this easier in the future).
Also, let me know when you have any questions of course! ๐
No problems. Working on this.
Thanks @CompuIves I've cloned this repo and did some work. While deploying static is pretty nice, its not as useful as being able to somehow deploy the compiled / bundled version as static. Ultimately, one works in a dev environment to make rapid changes; yet we deploy the optimized build. Static build can benefits from easier global distributions on CDNs.
It would really be a game changer to work online, build online, and deploy online.
@babakness one idea: set up CI to do the build & deploy to now for you? One risk: not sure how easy it is to set up CI to do that for you. If you figure something out let me know? (I haven't tried this myself yet)
@babakness here's how I deployed a codesandbox to my personal gh-pages site. It was pretty easy! Thanks codesandbox :)
unpublished, draft post:
title: How to Publish a Vue CodeSandbox.io to Github Pages on a Custom Domain
date: 2018-01-11 05:55 CET
tags: howto, js
author: dtrejo
Here's how I recently published dtrejo.com/colorpreview.
colorpreview.dtrejo.com, is a gh-pages site, which means that dtrejo.com/$PROJECTNAME$PROJECTNAME github pages site for a repo undergithub.com/dtrejo/$PROJECTNAMEgithub.com/dtrejo/colorpreview, and it will showdtrejo.com/colorpreviewnpm run build to create a dist/ folder, which I could then publishgh-pages./, not dtrejo.com/colorpreview. js
assetsPublicPath: '/colorpreview/', // for github pages off dtrejo.com/colorpreview/*
npm run build againdist folder somewhere else, e.g. dist-temp, just for nowdist (yes, again)dist, delete all the files and dotfiles except for the .git folderdist-temp back into distgh-pages branch:sh
git checkout -b gh-pages
git add . # repeat from here whenever you rebuild
git commit -m 'deploy'
git push -u origin gh-pages
https://dtrejo.com/colorpreview and you'll see your app!Thankfully, I spent almost 0 time messing with webpack configs, and developing
modern js apps in codesandbox is super painless. Thank you codesandbox.
It will be cool when it can support building/deploying to gh-pages and/or easy
setup with a CI system that does the same. I suppose I should have investigated
using travis or something to do deploys for me, maybe next time.
Yours,
David Trejo
Hey guys, I have an easier way, although it can be improved once GitLab support arrives.
GitLab has CI tools and task runners via Docker that can be triggered on push to a particular branch, let's say master. You can sync your repo to GitHub and then automate the push to GitLab, which will build your project. From there you can publish via GitLab and serve through CloudFlare.
Another route is to use Netlify. Same procedure, you deploy to GitHub, Netlify pulls in your repo, builds and deploys for you. Combined with an Netlify's CMS (which you can use on GitLab too)
https://github.com/netlify/netlify-cms
you pretty much have a simple, content-driven, static generated, and CDN deployed website all built in the cloud using only a web browser. Could even work on a Chromebook or iPad.
Hmm, that does not work for me.