Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

HTML

              
                <html lang="en">
<head>
  <meta charset="UTF-8">
  <title>JSX Alternative to Render Virtual DOM</title>
</head>
<body>
  <div id="app"></div><!-- Rendered with React -->
  
  
  
  <br><br><br>
  <p>Repo: <a href="https://github.com/gluecodes/gluecodes-glue-dom" target="_blank">README.md</a></p>
  <p>If you like it and want to get updated follow me on <a href="https://twitter.com/ChrisCzopp" target="_blank">twitter</a> or <a href="https://dev.to/chrisczopp" target="_blank">dev.to</a></p>
  <p>Do you want to play with a tool which lets you code web apps with HTML and spits out the presented syntax? Visit <a href="https://ide.glue.codes" target="_blank">ide.glue.codes</a>.</p>
  <p>Visit <a href="https://www.glue.codes" target="_blank">www.glue.codes</a> for more.</p>
</body>
</html>

              
            
!

CSS

              
                .bold {
  font-weight: 700;
}

.italic {
  font-style: italic;
}

              
            
!

JS

              
                // configure renderer
const tag = createRenderer({
  createVDomElement: React.createElement,
  formatters: {
    bold: () => ({
      tag: 'strong',
      props: { className: 'bold' }
    }),
    italic: () => ({
      tag: 'span',
      props: { className: 'italic' }
    })
  }
})

// example component
const exampleComponent = ({ 
  firstProgrammer,
  secondProgrammer,
  someCondition
}) => (
  tag('div', (props, { tag }) => {
    if (someCondition) {
      tag('p', (props, { text }) => {
        text({ bold: firstProgrammer }, ', you\'re going to do pair-programming with ', secondProgrammer, '.')
        
        if (!secondProgrammer) {
          text({ bold: { italic: firstProgrammer } }, ', you\'ll code this task by yourself.')
        }
        
        if (!firstProgrammer && !secondProgrammer) {
          text('Hey man! Can you tell us your name before we give you job to do?')
        }
      })
    }
  })
)

// app
const app = () => (
  tag('div', (props, { component, tag }) => {
    props.className = 'container'
    
    tag('h1', (props, { text }) => {      
      text('JSX Alternative to Render Virtual DOM')
    })
        
    component(exampleComponent, { // comment out props to see the effect
      firstProgrammer: 'Chris', 
      secondProgrammer: 'John',
      someCondition: true
    })
  })
)

// gluecode
React.render(
  app(),
  document.getElementById('app')
)


              
            
!
999px

Console