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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <!-- Put your template between the section tags! Normally Vash uses script tags
with type="text/vash", but codepen doesn't like those... -->
<section id="entry" type="text/vash">
  <p>Vash knows that is an email
    address and not an expression.</p>
  <p>Here is a list of characters:</p>
    @model.somearr.forEach(function(name){ <li>@name</li> })
  <h@model.heading>Tags can be programmatic</h@model.heading>
  @function img(src, alt){
    <img width="300" src="@src" alt="@alt" title="@alt" />
  <p>Macros are totally cool too!</p>
  <p>@img('', 'The $$60 Humanoid Typhoon')</p>


<!-- put json here to populate the "model" -->
<section id="model-json">
  "what": "odel says",
  "heading": 5,
  "somearr": ["Vash", "Meryll", "Milly", "Wolfwood"]

<!-- ignore below, these are just for output -->
<section id="lexer-tokens">
  <h1>Lexer Tokens</h1><pre></pre>
<section id="parse-tree">
  <h1>Parse Tree</h1><pre></pre>
<section id="output">
<section id="tpl-tostring">
  <h1>Template Decompiled</h1><pre></pre>


                * { font-size: 0.9em; }
section { float: left; min-width: 350px; overflow: hidden; }

#output { float: right; }
.error { padding: 5px; background-color: #B90606; color: white; }

#tpl-tostring { clear: both; }

#entry, #model-json { display: none; }


                vash.config.debug = false;

var input = $('#entry').html()

// Shortcuts
var htmlesc = function(str){ return vash.helpers.escape(str).toString(); }
    ,lineesc = function( input ){ return input.replace('\n', '\\n') }
// Show tokens via lexer
var l = new vash.VLexer( input )
    ,tokens = []

while( (tok = l.advance()) ) { tokens.push( tok ); }
var escaped ={ return htmlesc( lineesc(tok.toString()) ); });
$('#lexer-tokens pre').html( escaped.join('\n') );

// use token in parser, and show parse tree
var  p = new vash.VParser( tokens.reverse(), vash.config )

try {
  var ast = p.parse();
} catch(e) {
  $('#entry').before( '<pre class="error">' + htmlesc( e.message ) + '</pre>' );

var c = new vash.VCompiler( ast, input );

$('#parse-tree pre').html( htmlesc( ast.toTreeString() ) );

// Show output using #model-json
try {
  var tpl = vash.compile( input )
  $('#tpl-tostring pre').html( htmlesc(tpl.toString()) );
  var output = tpl( JSON.parse( $('#model-json').html() ) || {} );
  $('#output div').html( output.toString() );
} catch(e){
  $('#entry').before( '<pre class="error">' + htmlesc( e.message ) + '</pre>' );