Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with htm #6

Closed
mwildehahn opened this issue Mar 6, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@mwildehahn
Copy link

commented Mar 6, 2019

I haven't looked into this so not sure if it is possible, but it would be cool to integrate with: https://github.com/developit/htm so devs didn't have to have a transpiler.

@yhatt

This comment has been minimized.

Copy link
Member

commented Mar 7, 2019

Yeah, it's so cool. Currently, @speee-js/jsx-slack can use via htm such as following:

import JSXSlack, { Block, Section } from '@speee-js/jsx-slack'
import { bind } from 'htm'

const slack = (...args) => JSXSlack(bind(JSXSlack.h)(...args))
const name = 'htm'

console.log(slack`
  <${Block}>
    <${Section}>
      Hello, <b>${name}!</b>
    <//>
  <//>
`)
[
  {
    "type": "section",
    "text": {
      "text": "Hello, *htm!*",
      "type": "mrkdwn",
      "verbatim": true
    }
  }
]

But it has a bit counterintuitive interpolation for using Block component. (<${Block}><//>) Preparing tagged template that has already supported Block components is the best way to use jsx-slack without transpiler.

@yhatt

This comment has been minimized.

Copy link
Member

commented Mar 7, 2019

We've merged htm integration via jsxslack tagged template literal. (#7) We are going to bump up version if no problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.