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

              
                div#app
  div.input
    input(type="text" placeholder="タスクを入力" v-model="newTask")
    button(@click="addTask()").
      タスクを追加
    span(v-if="isError").error.
      ※タスクが空欄です
  div.output
    ul.task-list
      li(v-for="(task, index) in tasks" :key="index" class="task-item")
        button(@click="removeTask(index)").
          完了
        span.
          {{ task }}
    
              
            
!

CSS

              
                .input
  display: flex
  align-items: center
  flex-wrap: wrap
  padding: 16px
  input[type="text"]
    padding: 8px
    margin: 0 8px 0 0
    min-width: 160px
  button
    padding: 5px
    margin: 0 8px 0 0
  .error
    font-weight: bold
    color: red
.output
  padding: 0 16px
  li
    padding: 16px 0
    border-top: 1px solid #ddd
    span
      padding: 0 0 0 8px
      
              
            
!

JS

              
                const vueModel = new Vue({
  el: '#app',
  data: {
    newTask: '',
    tasks: [],
    isError: false
  },
  methods: {
    addTask() {
      if (this.newTask !== '') {
        this.tasks.push(this.newTask);
        this.newTask = '';
        this.isError = false;
      } else {
        this.isError = true;
      }
    },
    removeTask(index) {
      this.tasks.splice(index, 1);
    }
  }
});
              
            
!
999px

Console