Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div class="container">
  <div class="row">
    <div class="col-md-8 col-md-offset-4">
      <div class="padding">
        <h3>Использование шаблонизатора</h3>
        <h4>С использованием библиотеки jComponent</h4>
        <!--Компилирует содержимое HTML в виде шаблона Tangular. Может быть определен без выражения. Выражение может содержать jQuery, selector который позволяет сравнивать Virtual DOM для контента. В этом месте будет вставлен шаблон #example, а данные будут из переменной data1 -->
        <div data-bind="data1__template:{#example}"></div>
        <hr>
          <!--Будут вставленны данные из переменной data2, будет использован шаблон который находится между тегов script -->
        <div data-bind="data2__template">
          <script type="text/html">
            {{ foreach item in value }}
              {{ if item.id < 10 }}
                <p>Запись №{{item.id}}, {{item.descr}}, {{item.dt|format('dd.MM.yyyy hh:mm:ss')}}, индекс {{ $index }}</p>
              {{ fi }}
            {{ end }}
          </script>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/html" id="example">
	<p>Использование <span class="{{ value.color }}">шаблонов</span>. Это очень {{ value.how }}</p>
</script>

              
            
!

CSS

              
                
              
            
!

JS

              
                var data1 = {color: 'red', how: 'просто!'};
var data2 = [
  { id: 5, descr: 'Запись 5', dt: NOW },
  { id: 8, descr: 'Запись 8', dt: NOW },
  { id: 12, descr: 'Запись 12', dt: NOW },
  { id: 2, descr: 'Запись 2', dt: NOW }
];

setTimeout(function() {
   SET('data1', { color: 'green', how: 'супер просто!' });
}, 3000);
              
            
!
999px

Console