Socket
Socket
Sign inDemoInstall

comps-autonode-addons

Package Overview
Dependencies
15
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    comps-autonode-addons

Addons for autonode using comps


Version published
Maintainers
2
Install size
2.35 MB
Created

Readme

Source

comps-autonode-addons

Comps addons for autonode's es6 template syntax.

Usage

Install:

npm install comps-autonode-addons --save

Set custom tag:

var comps = require('comps')
var compsAutonodeAddons = require('comps-autonode-addons')

compsAutonodeAddons(comps)

Syntax

  • {% foreach $arr="items" $as="item" $index="i"%} {% /foreach %}

    Convert to items.map() syntax.

  • {% foreach $obj="items" $as="item" $key="k" $index="i"%} {% /foreach %}

    Convert to Object.keys(items).map() syntax.

  • {% if $is="condition" %} {% /if %}

    Convert to if (is) {return ''} syntax.

  • {% if $is="condition" %} {% else /%} {% /if %}

    Convert to if (is) {return ''} else {return ''} syntax.

  • {% if $is="condition" %} {% else $if="condition" /%} {% else /%} {% /if %}

    Convert to if (is) {return ''} else if (is) {return ''} else {return ''} syntax.

  • {% component $id="xxx" with="value" /%}

    Convert to with(value) {} syntax.

  • {% include $path="./xxx" with="value" /%}

    Convert to with(value) {} syntax.

  • {% scope var1="expression" var2="expression" %} {% /scope %}

    Declare variables in that scope.

  • {% function var1="expression" var2="expression" %} {% /function %}

    Create a function scope with specified variables.

    {% function isActive="curid === id" /%}
        if (isActive) {
            return `<div item="active"></div>`
        } else return `<div></div>`
    {% /function %}
    
  • {%/ this is comment... /%}

    Comment syntax for comps.

Keywords

FAQs

Last updated on 21 Dec 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc