Yet Another JSX using tagged template

Overview

우아한 JSX

Yet Another Simple JSX using tagged template

언어의 한계가 곧 세계의 한계다 - Ludwig Wittgenstein

우아한 JSX가 캠퍼들의 표현의 자유를 넓히고 세계를 넓히는데 도움이 되었으면 합니다

Example

import html from 'woowahan-jsx';

const state = {
  counter: 0,
};

const setCounter = val => {
  state.counter = val;
  render();
};

const containerClassName = 'counter-wrapper';

function render() {
  const $app = document.querySelector('#app');
  // myComponent는 HTMLElement 타입입니다.
  const myComponent = html`
    <div class="${containerClassName}">
      <button
        class="btn"
        onClick=${() => {
          setCounter(state.counter - 1);
        }}
      >
        -
      </button>
      <span>${state.counter}</span>
      <button
        class="btn"
        onClick=${() => {
          setCounter(state.counter + 1);
        }}
      >
        +
      </button>
    </div>
  `;
  $app.innerHTML = '';
  $app.appendChild(myComponent);
}

render();

counter

장점

Prettier로 포매팅이 자동으로 됩니다.

스트링뿐만 아니라 함수나 DOM도 ${}에 넘길 수 있어요!! ^0^

onClick이나, onInput 같은 콜백 함수를 넘겨보세요. click 예제, input 예제

Child Component도 지원 합니다! ${} 안에다가 DOM Object 넣으면 렌더링 돼요! 예제

Child Component List 됩니다. Map 함수 써서 리액트 JSX 처럼 쓸 수 있어요. 예제

Install

타입스크립트, 자바스크립트 전부 지원해요

yarn add woowahan-jsx

Install (Copy & Paste)

타입스크립트 코드를 copy & paste 해서 쓰세요!

이 레포를 clone받고 yarn build 해서 나온 lib/index.js 를 가져가서 쓰세요

Comments
  • babel 7 사용자를 위한 안내 추가를 건의드립니다!

    babel 7 사용자를 위한 안내 추가를 건의드립니다!

    스크린샷 2021-07-31 오후 6 41 57

    제공해주신 src 디렉토리 내에 있는 jsx.js, jsx.ts는 이미 트랜스파일링이 된 상태의 파일인데, 혹시 트랜스파일링 단계에서 babel 버전이 6.x.x이었나요? 그로 인해 core-js의 버전이 3인거 같습니다. 해당 파일은 사용자의 프로젝트에서 다시 번들/트랜스파일링의 대상이 될 수 있기 때문에 문제가 발생하는거 같습니다!

    저는 babel 7을 사용중인데, babel 7의 기본 core-js 버전이 2라서 그대로 가져다 쓰면 core-js not found 에러가 발생하더라구요.

    babel 설정 파일에 corejs 버전을 3으로 명시함으로써 해결했습니다!

    {
    	"presets": [
    		[
    			"@babel/preset-env",
    			{
    				"targets": "> 1%, not dead",
    				"useBuiltIns": "usage",
    				"corejs": 3 // babel 7 버전부터는 기본이 2이기 때문에 3으로 지정해줘야 함.
    			}
    		]
    	]
    }
    
    

    문제 해결에 도움이 된 아티클 링크입니다

    https://e2xist.tistory.com/741

    opened by jjunyjjuny 5
  • NPM 등록 건의드립니다.

    NPM 등록 건의드립니다.

    복사해서 사용하는것보다 npm 등록 이후 npm에서 다운받아 module 형식으로 쓰게 해보는건 어떨까요?

    내 패키지 npm 등록하기 링크를 보면서 올려도 좋을 것 같습니다.

    사실 개인 프로젝트에 한번 써보고싶은데, npm으로 되어있으면 누가 개발했는지 등을 알 수 있어서 좋을 것 같습니다~

    opened by sshrik 2
  • Change return node type

    Change return node type

    DocumentFragment를 리턴하는것에서 Element를 리턴하는것으로 바꿨어요

    DocumentFragment가 가볍고 속도는 빠르지만

    한번 다른곳에 appendChild되면 자기 참조가 없어져서 사용성이 안좋을것같아서

    느리더라도 Element를 다루는게 좋을것같아서 바꿨어요

    추가 변경사항:

    • README 설명을 더 친절하게 바꿨어요
    opened by gomjellie 0
  • Counter Example 적용

    Counter Example 적용

    https://user-images.githubusercontent.com/13645032/126921683-b2296c81-57b9-4524-bfe5-9c1f7a9a386d.mov

    잘됩니다!

    이미지 추가하니 dependency가 하나 필요해서 늘어났어요.

    • @parcel/transformer-image
    opened by gomjellie 0
  • Feature/text replacement

    Feature/text replacement

    • text node replace 기능 추가
    • attribute 타입 string 대응
    • npm start script 수정(serve 제외)
    • vscode debug 설정 및 gitignore 추가
    • parcel 버전 수정(nigthly) : sourceMap 버그 해결버전
    opened by cothis 0
Owner
null
🍼 650B Virtual DOM - Use reactive JSX with minimal overhead

?? little-vdom Forked from developit's little-vdom gist. npm: npm i @luwes/little-vdom cdn: unpkg.com/@luwes/little-vdom 650B Virtual DOM Components S

wesley luyten 87 Nov 12, 2022
🌲The perfect personal website template.

Conifer ?? Conifer is an easy to use, fun and rewarding template to help you build your own personal website. It is 100% free to use- and aimed at tho

Toby 7 Nov 27, 2022
Boilerplate starter template for a new Telegram Web App (TWA) interacting with the TON blockchain

TON Starter Template - Telegram Web App (TWA) Starter template for a new TWA interacting with the TON blockchain Overview This project is part of a se

TON @ DeFi.org 11 Dec 17, 2022
Frontend framework for creating reactive UIs using direct DOM manipulation. (WIP)

Cosmos Framework A frontend framework for creating reactive UIs using direct DOM manipulation. (Heavily WIP) How to get started with Cosmos Framework

CosmicMedia 5 Nov 6, 2022
Re-developed the Sky Ice Cream website using ReactJS. Redesigned the UI to a much more appealing and intuitive styling.

This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: npm start Runs the app in the developmen

Aakash Jana 1 Dec 27, 2021
KioskBoard - A pure JavaScript library for using virtual keyboards.

KioskBoard - Virtual Keyboard A pure JavaScript library for using virtual keyboards. Current Version 2.0.0 * Documentation and Demo https://furcan.git

Furkan MT 177 Dec 29, 2022
Yet-Another-Relog-Mod - Just another relog mod. Call it YARM!

Yet Another Relog Mod A relog mod with a name so long, you can just call it YARM for short. Features An aesthetic relog list design that follows my "p

Hail 0 Oct 19, 2022
Maybe better conditionals feat. tagged template literals

condicional Maybe better conditionals Report Bug · Request Feature About The Project ⚠️ `condicional` is based on a PEG grammar and is not battle-test

null 3 Oct 12, 2022
Generate tagged PDFs from your Eleventy site

eleventy-plugin-prince-pdf This plugin makes it easy to generate tagged PDFs from webpages in your Eleventy site, using Prince. What this does This pl

null 4 Feb 9, 2022
A small library aims to improve better tagged-unions/discriminated-unions supporting for TypeScript

coproduct A small library aims to improve better tagged-unions/discriminated-unions supporting for TypeScript Benefits Small bundled size(just 1kb) Ea

工业聚 29 Aug 15, 2022
Yet another megamenu for Bootstrap 3

Yamm This is Yet another megamenu for Bootstrap 3 from Twitter. Lightweight and pure CSS megamenu that uses the standard navbar markup and the fluid g

geedmo 1.2k Nov 10, 2022
yet another unzip library for node

yauzl yet another unzip library for node. For zipping, see yazl. Design principles: Follow the spec. Don't scan for local file headers. Read the centr

Josh Wolfe 622 Dec 26, 2022
yet another zip library for node

yazl yet another zip library for node. For unzipping, see yauzl. Design principles: Don't block the JavaScript thread. Use and provide async APIs. Kee

Josh Wolfe 307 Dec 3, 2022
Yet another Linux distribution for voice-enabled IoT and embrace Web standards

YodaOS is Yet another Linux Distribution for voice-enabled IoT and embrace Web standards, thus it uses JavaScript as the main application/scripting la

YODAOS Project 1.2k Dec 22, 2022
Alternatively called Yet Another Enhancement Point Tracker

Yet Another Talent Tracker Alternatively called Yet Another Enhancement Point Tracker, but that name doesn't sound as cool in an acronym, so let's cal

Hail 2 Oct 17, 2022
Yet another concurrent priority task queue, yay!

YQueue Yet another concurrent priority task queue, yay! Install npm install yqueue Features Concurrency control Prioritized tasks Error handling for b

null 6 Apr 4, 2022
Yet another eslint blame (might) with better adaptability

yet-another-eslint-blame Yet another eslint blame (might) with better adaptability. The input is eslint's output with json format (You can see it here

快手“探索组”前端 5 Mar 7, 2022
Yet another basic minter.

Mojito Yet another basic minter. Live demo: https://mojito-app.netlify.app/ Motivation The create-eth-app team recently added useDApp in their v1.8.0,

Julien Béranger 3 Apr 26, 2022