GithubHelp home page GithubHelp logo

b8r-component-vscode's Introduction

b8r-component README

This is a simple language extension extension for working with b8r in vscode.

Features

HTML and CSS Syntax Hiliting

When you're writing javascript extension using the pure javascript format, it's common to have inline html and css embedded in template-string properties. The extension simply tells vscode to syntax-color these as css and javascript.

export default {
  html: `
... html goes here
`
}

Unfortunately, vscode cannot match tokens across multiple lines, so if you write:

export default {
  css:
`
.foo {
  color: black;
}
`
}

It won't recognize the css (in this case). Just remove the newline between css: and the backtick and it will hilite correctly.

Component Boilerplate

Once you've installed the extension you can type component and insert boilerplate for a javascript component, complete with a documentation block on top. This is what it inserts…

/**
# component-name
*/

export default {
  css: `
    ._component_ > div { color: yellow }
  `,
  html: `
    <div>this text is yello</div>
  `,
  /*
    component (container element), b8r, data (component private data)
    find(selector), findOne(selector), get(path), set(path), on(event, path), touch(path)
  */
  async initialValue({ b8r, component, find, findOne, on, get, set, touch }){
    // your setup code here
    // do not call get/set here since you are still creating the data!
    return {
      // initial state of component
    }
  },
  async load({ b8r, component, data, find, findOne, on, get, set, touch }){
    // your javascript goes here
  },
}

Finally, writing b8r code involves typing _component_ a lot. So there's a snippet for that.

b8r-component-vscode's People

Contributors

tonioloewald avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.