Introducing the Vanilla Template to CodeSandbox

Written by compuives | Published 2018/02/28
Tech Story Tags: javascript | web-development

TLDRvia the TL;DR App

From day one we’ve always tied templates to a CLI. The main reason for this is that we want to keep sandboxes simple, you shouldn’t need to do any configuration to get started. I didn’t want to create a ‘Vanilla’ template because there was no way to create ‘vanilla’ web projects without configuration, until recently.

Parcel

A new bundler called ‘Parcel’ was released in December by devongovett. Parcel is a web application bundler that values zero configuration. They reuse classic web concepts, like using index.html as the entry point of the application, which makes it really easy and intuitive to get started with a new project. You only have to create an index.html and run parcel index.html to get a working application. They automatically detect what kind of web application you’re running, and adapt the configuration to that if it’s not specifically set.

This is aligns perfectly with the values of CodeSandbox. There is almost no friction to get started, and all the needed configuration is automatically detected & installed. That’s why I decided to finally build a Vanilla template and use Parcel as our configuration behind it.

Vanilla Template

We have a new sandbox called vanilla, unlike other sandboxes, this sandbox has index.html as its entry. From this index.html you can add script and link tags to other files and they will be added to the bundle. We support all loaders that Parcel supports, so we support:

  • Babel
  • TypeScript
  • SCSS/SASS
  • LESS
  • Stylus
  • CSS Modules

We also recognize the difference between:

import styles from './styles.css';

and

import './styles.css';

In the first code block we will generate css modules from the css file, and in the second block we won’t.

You can try it out here:

Configuration

Like Parcel, we automatically do configuration for you. We automatically detect if you’re using react or preact and will adjust our Babel configuration for it. We do support Babel/TypeScript configuration, so you can also choose to do your own configuration by creating a tsconfig.json or a .babelrc.

GitHub, Zip Extraction & Deployment Integration

Like the other templates, you can create repos, make commits and PRs, download and deploy sandboxes using this template. Without leaving the browser.

Beta Warning

This is our first template that uses html as an entry point, so there can be bugs or unintended behaviour that still needs to be solved. Please let us know in the repo if you find any issues!

CompuIves/codesandbox-client_codesandbox-client - An online code editor tailored for web application development 🏖️_github.com

Thanks

I want to thank devongovett for building this beautiful bundler, I was able to effortlessly build an application in it. Great work!

If you like what we’re doing, consider becoming a contributor or a patron! You can stay up to date with CodeSandbox news either on @CompuIves or @codesandboxapp.


Published by HackerNoon on 2018/02/28