Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.






                const list = ["apples", "oranges"]
let counter = 0

/*window.setInterval(tick, 1000);

function tick() {
  counter = counter + 1   
  render(a(), "#app")

let s = style`
   color: red;
   text-transform: uppercase;  

let o = style`
  color: green;

let b = `

let Counter = counter => `

let app = props => `
  <div class=${s}>
    hello world
    ${, key) => {
        return `<li>${el}</li>`
      // Get rid of comma by joining array:

  <div class=${o}>Counter: ${Counter(counter)}</div>

render(app(), "#app")

function style(s) {
  const style = document.createElement('style')
  const id = generateID(8) = randomNumber(2)
  let myStyle = `
    .${id} {
  style.innerHTML = myStyle
  //style.innerHTML = myStyle.replace(/ /g,'')
  return id

function toHTML(string) {
  const parser = new DOMParser()
  let node = parser.parseFromString(string, "text/html")
  return node.body.childNodes

function render(string, root) {
  const node = document.querySelector(root)
  // TODO: Instead of deleting, diff dom
  while (node.firstChild) {
  toHTML(string).forEach(n => {

// Random number from 0 to length
function randomNumber (length) {
  return Math.floor(Math.random() * length)

// Generate Pseudo Random String, if safety is important use dedicated crypto/math library for less possible collisions!
function generateID (length) {
  const possible =
  let text = "";
  for (let i = 0; i < length; i++) {
    text += possible.charAt(randomNumber(possible.length));
  return text;

document.body.addEventListener('click', () => {
  counter = counter + 1   
  render(app(), "#app")